-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: SemiFuture::wait is setting the callback on a future. https://www.internalfb.com/code/fbsource/[461b4373492f97727d71c8cc9ef563816a491e77]/fbcode/folly/futures/Future-inl.h?lines=2323%2C2329-2332 There may only be one callback per future. And the callback should only be set once. This future is saved inside an object that is stored in a cache that is shared across threads: https://www.internalfb.com/code/fbsource/[805d0ff899c1c8524c10b3aac52a0be9ca262123]/fbcode/eden/common/utils/ProcessInfoCache.cpp?lines=22%2C39%2C157%2C165 That means multiple threads could call wait on the same future concurrently. Which breaks some SemiFuture invariants and causes crashes like this: P1009632719 & P1517801272. These crashes are both from Muir's machine since he seems to repro this crash a lot. Tho we saw other users with these crashes too IIRC. Since we want multiple threads to take action when a promise is set. SharedPromise fits our needs better. SharedPromise can have multiple futures so multiple threads can wait for the promise to be set concurrently (on seperate futures). Reviewed By: MichaelCuevas Differential Revision: D61479252 fbshipit-source-id: e23192e4090275648d363ce1638ad4f33fd0b3d0
- Loading branch information
1 parent
cffa5b3
commit b165bb6
Showing
3 changed files
with
53 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters