Repository navigation
fix(ether): harden asynchronous shutdown and timer lifetime - #592
luisgutierrezpereda wants to merge 1 commit into
Conversation
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); | ||
| } | ||
|
|
||
| Configuration config_ = makeConfiguration(); |
There was a problem hiding this comment.
❌ misc-non-private-member-variables-in-classes ❌
member variable config_ has protected visibility
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) | ||
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member config_
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) | |
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) | |
| : discovery_(DiscoverySystem::make(config, discoveryIo_)) | |
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config, exclusions_)) |
| [[nodiscard]] std::unique_ptr<EtherTransport> makeTransport() const | ||
| { | ||
| return std::make_unique<EtherTransport>( | ||
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member config_
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); | |
| config, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); |
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); | ||
| } | ||
|
|
||
| Configuration config_ = makeConfiguration(); |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member config_
| Configuration config_ = makeConfiguration(); | |
| Configuration config = makeConfiguration(); |
| } | ||
|
|
||
| Configuration config_ = makeConfiguration(); | ||
| NetworkExclusions exclusions_; |
There was a problem hiding this comment.
❌ misc-non-private-member-variables-in-classes ❌
member variable exclusions_ has protected visibility
| protected: | ||
| EtherTransportTest() | ||
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) | ||
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member exclusions_
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) | |
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions)) |
| [[nodiscard]] std::unique_ptr<EtherTransport> makeTransport() const | ||
| { | ||
| return std::make_unique<EtherTransport>( | ||
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member exclusions_
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); | |
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions, runtimeFootprint_); |
| } | ||
|
|
||
| Configuration config_ = makeConfiguration(); | ||
| NetworkExclusions exclusions_; |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member exclusions_
| NetworkExclusions exclusions_; | |
| NetworkExclusions exclusions; |
|
|
||
| Configuration config_ = makeConfiguration(); | ||
| NetworkExclusions exclusions_; | ||
| asio::io_context discoveryIo_; |
There was a problem hiding this comment.
❌ misc-non-private-member-variables-in-classes ❌
member variable discoveryIo_ has protected visibility
| { | ||
| protected: | ||
| EtherTransportTest() | ||
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member discoveryIo_
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) | |
| : discovery_(DiscoverySystem::make(config_, discoveryIo)) |
|
|
||
| Configuration config_ = makeConfiguration(); | ||
| NetworkExclusions exclusions_; | ||
| asio::io_context discoveryIo_; |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member discoveryIo_
| asio::io_context discoveryIo_; | |
| asio::io_context discoveryIo; |
| Configuration config_ = makeConfiguration(); | ||
| NetworkExclusions exclusions_; | ||
| asio::io_context discoveryIo_; | ||
| std::shared_ptr<DiscoverySystem> discovery_; |
There was a problem hiding this comment.
❌ misc-non-private-member-variables-in-classes ❌
member variable discovery_ has protected visibility
| { | ||
| protected: | ||
| EtherTransportTest() | ||
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member discovery_
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) | |
| : discovery(DiscoverySystem::make(config_, discoveryIo_)) |
| [[nodiscard]] std::unique_ptr<EtherTransport> makeTransport() const | ||
| { | ||
| return std::make_unique<EtherTransport>( | ||
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member discovery_
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); | |
| config_, "etherTransportTest", "etherTransportTest", discovery, nullptr, exclusions_, runtimeFootprint_); |
| Configuration config_ = makeConfiguration(); | ||
| NetworkExclusions exclusions_; | ||
| asio::io_context discoveryIo_; | ||
| std::shared_ptr<DiscoverySystem> discovery_; |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member discovery_
| std::shared_ptr<DiscoverySystem> discovery_; | |
| std::shared_ptr<DiscoverySystem> discovery; |
| NetworkExclusions exclusions_; | ||
| asio::io_context discoveryIo_; | ||
| std::shared_ptr<DiscoverySystem> discovery_; | ||
| std::shared_ptr<RuntimeNetworkFootprintState> runtimeFootprint_; |
There was a problem hiding this comment.
❌ misc-non-private-member-variables-in-classes ❌
member variable runtimeFootprint_ has protected visibility
| protected: | ||
| EtherTransportTest() | ||
| : discovery_(DiscoverySystem::make(config_, discoveryIo_)) | ||
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member runtimeFootprint_
| , runtimeFootprint_(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) | |
| , runtimeFootprint(std::make_shared<RuntimeNetworkFootprintState>(config_, exclusions_)) |
| [[nodiscard]] std::unique_ptr<EtherTransport> makeTransport() const | ||
| { | ||
| return std::make_unique<EtherTransport>( | ||
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member runtimeFootprint_
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint_); | |
| config_, "etherTransportTest", "etherTransportTest", discovery_, nullptr, exclusions_, runtimeFootprint); |
| NetworkExclusions exclusions_; | ||
| asio::io_context discoveryIo_; | ||
| std::shared_ptr<DiscoverySystem> discovery_; | ||
| std::shared_ptr<RuntimeNetworkFootprintState> runtimeFootprint_; |
There was a problem hiding this comment.
❌ readability-identifier-naming ❌
invalid case style for protected member runtimeFootprint_
| std::shared_ptr<RuntimeNetworkFootprintState> runtimeFootprint_; | |
| std::shared_ptr<RuntimeNetworkFootprintState> runtimeFootprint; |
| #include <memory> | ||
| #include <mutex> | ||
| #include <thread> | ||
| #include <vector> |
There was a problem hiding this comment.
❌ misc-include-cleaner ❌
no header providing "std::ignore" is directly included
| #include <vector> | |
| #include <tuple> | |
| #include <vector> |
Keep the ASIO io_context alive until its executor exits, preventing shutdown from destroying scheduler state while io_context::run() is still active. Synchronize timer creation with context teardown and avoid retaining references to timer-map entries that may be erased concurrently. Make pending accept callbacks retain their acceptor and explicitly stop accepting during shutdown. Also ensure destruction performs final transport cleanup. Add regression tests covering shutdown from the executor thread, shutdown while a handler is running with additional work queued, and timer creation, cancellation, and expiry racing with shutdown.
427a252 to
c3e2b7c
Compare
Keep the ASIO io_context alive until its executor exits, preventing shutdown from destroying scheduler state while io_context::run() is still active.
Synchronize timer creation with context teardown and avoid retaining references to timer-map entries that may be erased concurrently. Make pending accept callbacks retain their acceptor and explicitly stop accepting during shutdown. Also ensure destruction performs final transport cleanup.
Add regression tests covering shutdown from the executor thread, shutdown while a handler is running with additional work queued, and timer creation, cancellation, and expiry racing with shutdown.