You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect cleanup of async_context_threadsafe_background.c #3178
Noticed when reviewing code for #3179, the cleanup here is incorrect subject to race (or at least unlucky timing) conditions, and is also not correct for custom alarm pools.. see comments in the source file.
I think this is worth testing as a lifecycle invariant rather than patching one cleanup path in isolation.
I'd exercise:
the default alarm pool
a custom alarm pool
teardown while an alarm is pending
teardown while the background worker is active
repeated init/deinit
callbacks racing with the final teardown
The useful acceptance condition seems to be: after async_context_deinit() returns, no callback associated with that context can execute and no alarm remains registered against either the default or custom pool.
That should make it easier to tell whether the fix belongs in async_context_threadsafe_background_deinit() itself or in the underlying alarm-worker removal contract.
Activity
kilograham commentedon Sep 5, 2026
cc @peterharperuk
kvnloo commentedon Sep 29, 2026
I think this is worth testing as a lifecycle invariant rather than patching one cleanup path in isolation.
I'd exercise:
The useful acceptance condition seems to be: after
async_context_deinit()returns, no callback associated with that context can execute and no alarm remains registered against either the default or custom pool.That should make it easier to tell whether the fix belongs in
async_context_threadsafe_background_deinit()itself or in the underlying alarm-worker removal contract.