-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Internal node io context #4618
Internal node io context #4618
Conversation
@@ -139,13 +140,15 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, uint16_t pe | |||
} | |||
|
|||
nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesystem::path const & application_path_a, nano::node_config const & config_a, nano::work_pool & work_a, nano::node_flags flags_a, unsigned seq) : |
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.
A reference to io_ctx is still passed, unnecessarily. Removing it now would add noise. Such cleanup can be easily done in a subsequent PR.
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.
Comments are just observations. This fixes a locally consistently failing test socket.max_connections.
Even though some parts are rough around the edges, ipc_service::stop, I'd much rather get this change in as it's been attempted many times and never finished.
Currently all nodes, rpc and ipc servers share common IO context. This PR changes it, so that each node owns and runs its own io_context. This ensures that any io operations scheduled to run using that executor can't outlive the node itself. This greatly simplifies system design.
It's likely that this will uncover many race conditions in tests. The most obvious ones should already be fixed, but please keep in mind that if a test starts failing after this PR, it likely wasn't fully correct to start with.