-
Notifications
You must be signed in to change notification settings - Fork 6k
Retain a reference to the CFRunLoop until MessageLoopDarwin::Terminate exits #34735
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
zanderso
left a comment
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.
Is there any way to write a test for this?
6678eb7 to
dd7da82
Compare
|
This is a race between the use of the As we have seen, the race will eventually occur when repeatedly running the existing tests that call |
|
I must admit I don't understand this fix. The thread won't stop until the run loop has exited though right? Fortunately, CoreFoundation is open-source, and reading the code, it looks like |
|
Without this fix, at best the code is relying on implementation details of CoreFoundation for safety. And AFAICT the CoreFoundation documentation does not promise that this usage pattern is allowed. In these tests, thread A is calling Before this fix, the only reference to the So there is now a race between Thread A's potential use of the I was able to reproduce this crash reasonably often by running this with a When the crash occurred I captured a core dump with this backtrace: This implied that the After applying this PR I have not been able to reproduce the crash with the command above. |
Fixes flutter/flutter#106588