-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Keep http_plugin_impl alive while connection objects are alive #9512
Conversation
…their destructors need the io_context of the http_plugin_impl thread_pool io_context
Please use the standard template for the description. |
@heifner Can you please review this PR? Thanks! |
@nksanthosh this is all my code Qing just made the PR. Needs to be reviewed by someone else. |
@@ -938,12 +951,15 @@ namespace eosio { | |||
my->thread_pool->stop(); | |||
} | |||
|
|||
// release http_plugin_impl_ptr shared_ptrs captured in url handlers | |||
my->url_handlers.clear(); |
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.
This isn't quite enough. The thread pool's io_context
may contain unexecuted handlers that hold shared_ptrs
to the http_plugin_impl
.
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.
I'm not following. The io_context
destructor will destroy all the unexecuted handlers that hold shared_ptrs
to http_plugin_impl
.
https://www.boost.org/doc/libs/develop/doc/html/boost_asio/reference/io_context/_io_context.html
Do you just mean the comment is not clear? Or do you see an issue here?
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.
You're only stopping the thread pool, not resetting it. This leaves a shared_ptr
cycle.
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.
Ah. Thanks!
Change Description
When the nodeos is killed, the thread_pool and associated io_context of the http_plugin_impl should keep alive for the lifetime of the connection object
Change Type
Select ONE
Consensus Changes
API Changes
Documentation Additions