• Nils Goroll's avatar
    Fix a race between VBP_Remove() and vbp_thread() · 6a3775fa
    Nils Goroll authored
    Suppose the following happens:
    
    vbp_task() finishes with vt->running = 0 and a heap insert. The
    vbp_cond is signaled under the lock, but now instead of vbp_thread()
    waking up first, VBP_Remove() gets the lock and reaches
    assert(vt->heap_idx == VBH_NOIDX) before the racing vbp_thread()
    deleted the heap.
    
    This is unlikely to happen with static backends, because for those,
    the probe is stopped via the vcl temperature before they get removed.
    
    Fixes https://github.com/nigoroll/libvmod-dynamic/issues/100
    6a3775fa
cache_backend_probe.c 16.9 KB