-
Notifications
You must be signed in to change notification settings - Fork 610
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when TilePromise is fulfilled after connection is destroyed
Summary: There is a heap-use-after-free when the `fn` in `HandlerCallbackBase::fulfillTilePromise` runs because it is possible that the connection has already been destroyed by the time the EventBase executes `fn`. This is because the destruction of the connection is guarded by "inflight requests" which gets decremented after the response is sent to the client from the EventBase. The response gets added to the EventBase through a custom ReplyQueue which doesn't limit max number of items processed in the event loop but the tile fulfillment gets added to the EventBase using the general queue which does limit max number of items processed in the event loop. As a result, the response task gets completed before the tile fulfillment task and allows the connection to be destroyed before the tile is fulfilled. To fix, we can enqueue the tile fulfillment using the same custom queue to ensure that the tile is always fulfilled before the response is sent. Reviewed By: yfeldblum Differential Revision: D64521715 fbshipit-source-id: 8dceedae53a9a88f409931601fd2e093dc74b521
- Loading branch information
1 parent
d43da36
commit a81fe64
Showing
2 changed files
with
57 additions
and
21 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