-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Darwin] Fix Watchable Event Manager Select crash on shutdown #8985
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about WatchableEventManager::CancelTimer
(both versions)? Should that not be doing the dispatch source cancellation?
In the old code we did this cancellation in Timer::Cancel
. Should it just happen in Timer::Clear
now? Should there be documentation for Clear
, for that matter?
Size increase report for "esp32-example-build" from af3fefb
Full report output
|
Yeah maybe As for CancelTimer, I think we're okay to do it in both places because of the single queue nature of the whole implementation. If a timer is canceled then we won't see it in the list while shutting down, and if not, then shutdown will remove it before it gets to execute. |
I guess my question is: if we don't do it in |
Yes, they would :) . |
Sounds like we should be able to test that certainly in a unit test... Set a timer, cancel it, sleep a bit, spin the event loop, see if the timer fires.... |
It is (unless I copied that wrong).
The cancellation belongs in
In line with issue #7715, the end state is that the |
Ah, I see. |
The previous code had |
Problem
#8800 split out some functionality into their own implementations. In the new code that was added, timers are not properly cancelled during shutdown.
This leads to a crash when shutdown is called while a timer is queued. The timer will run after everything has shutdown and will crash on an assert.
Change overview
Cancel all pending timers while shutting down The WatchableEventManager.
Testing
How was this tested? (at least one bullet point required)
We need more testing for all this code. I don't see any unit tests here. I'm unsure how to go about adding tests here.
I tested this manually with the iOS controller which restarts the Darwin CHIP stack before pairing. The controller no longer crashes when calling shutdown before subsequent pairings.