| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Track each listener in a ListenerSlot with active-callback draining so removeListener and shutdown block until in-flight FFI events finish before the owning object (e.g. Room) is destroyed. Add unit tests that reproduce the reported event-vs-destruction race. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
nice this looks good -- thank you for driving this down!
testing is king ofc, and the unit tests seem pretty wholesome! Just given that we know this should addresses instability and that a customer will immediately use this, I would suggest a more thorough body of the PR and adding something about a Listener state machine (or something similar) to the commit.
Sorry, something went wrong.
Fixes a use-after-free crash when a Room (or any listener owner) is destroyed while the FFI thread is still dispatching an event into its FfiClient listener. Observed both in flaky integration tests and user-reported. * Introduce ListenerSlot (additional state around Listener) to track in-flight listener callbacks; removeListener() and shutdown() block until active callbacks finish before teardown proceeds * Set a removed flag before draining so stale pushEvent snapshots do not start new callbacks after unregister * Replace the initialized_ bool with a LifecycleState enum and compare_exchange_strong for single-flight initialize() / shutdown(), and to drop events / reject new listeners during shutdown * Added 2 unit tests to verify fixes are resiliant
| Back | FazBrowse Home | New Git URL |
Fixes a use-after-free crash when a Room (or any listener owner) is destroyed while the FFI thread is still dispatching an event into its FfiClient listener. Observed both in flaky integration tests and user-reported.