Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a race between VBP_Remove() and vbp_thread() #3957

Merged
merged 1 commit into from Jul 17, 2023

Conversation

nigoroll
Copy link
Member

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 nigoroll/libvmod-dynamic#100

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 nigoroll/libvmod-dynamic#100
@nigoroll nigoroll merged commit 6a3775f into varnishcache:master Jul 17, 2023
13 of 14 checks passed
@nigoroll nigoroll deleted the dynamic100_vbp_remove_race branch July 17, 2023 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assert error in VBP_Remove()
1 participant