[Native] Fix use-after-free in HTTP callbacks (#19863)#19865
[Native] Fix use-after-free in HTTP callbacks (#19863)#19865pranjalssh merged 1 commit intoprestodb:masterfrom
Conversation
|
This pull request was exported from Phabricator. Differential Revision: D46674355 |
69df4d2 to
023730e
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46674355 |
023730e to
8b6e41e
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46674355 |
8b6e41e to
2b62710
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46674355 |
2b62710 to
71917bd
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46674355 |
There was a problem hiding this comment.
@pranjalssh Changes look good to me. Can you please update the commit message with [native] prefix and add a description?
@xiaoxmeng can you take another look? Thanks.
71917bd to
4da1541
Compare
|
@pranjalssh has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: In the HTTPClient, callbacks are scheduled on an eventBase. HTTPClient is kept alive using a shared_ptr, but it contains a raw pointer to MemoryPool. This MemoryPool may be freed if Task is aborted earlier, but a callback is executed much later. We see crashes related to this when the batch cluster is under heavy load. So the fix here is to keep shared_ptr to MemoryPool isntead of a raw pointer ``` == NO RELEASE NOTE == ``` Pull Request resolved: prestodb#19865 Reviewed By: xiaoxmeng Differential Revision: D46674355 Pulled By: pranjalssh fbshipit-source-id: 9b53deb6357ff87b8e1a992f3205d0ce9d79c05c
4da1541 to
6b38013
Compare
|
This pull request was exported from Phabricator. Differential Revision: D46674355 |
xiaoxmeng
left a comment
There was a problem hiding this comment.
@pranjalssh Thanks for the fix!
Summary: In the HTTPClient, callbacks are scheduled on an eventBase. HTTPClient is kept alive using a shared_ptr, but it contains a raw pointer to MemoryPool. This MemoryPool may be freed if Task is aborted earlier, but a callback is executed much later. We see crashes related to this when the batch cluster is under heavy load. So the fix here is to keep shared_ptr to MemoryPool isntead of a raw pointer ``` == NO RELEASE NOTE == ``` Pull Request resolved: prestodb#19865 Reviewed By: xiaoxmeng Differential Revision: D46674355 Pulled By: pranjalssh fbshipit-source-id: 9b53deb6357ff87b8e1a992f3205d0ce9d79c05c
Summary:
In the HTTPClient, callbacks are scheduled on an eventBase. HTTPClient is kept alive using a shared_ptr, but it contains a raw pointer to MemoryPool. This MemoryPool may be freed if Task is aborted earlier, but a callback is executed much later.
We see crashes related to this when the batch cluster is under heavy load.
So the fix here is to keep shared_ptr to MemoryPool isntead of a raw pointer
Differential Revision: D46674355