-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Networking & Observability
-
Networking & Obs 2024-09-16, Networking & Obs 2024-09-30, Networking & Obs 2024-10-14, Networking & Obs 2024-10-28, Networking & Obs 2024-11-11, Networking & Obs 2024-11-25, Networking & Obs 2024-12-09
ConnectionPoolTL currently has trouble cancelling connection setup during shutdown:
- AsyncDBClient::connect is uninterruptible
- AsyncDBClient::cancel only cancels in-progress operations, so if it happens to be called in between them, connection setup will continue uninterrupted.
In addition to this, ConnectionPool::shutdown does not wait for these in-progress tasks to complete. As a result, the underlying reactor may shut down before they've all been completed. This will cause the setup callbacks to be posted to the reactor and never run (e.g. if posted through asio async read/write methods) or dropped altogether if scheduled via thenRunOn (due to SERVER-79072).
To improve this, we should make TLConnection setup interruptible (e.g. by adding CancellationToken support to AsyncDBClient::connect). Then, we should wait until all in-progress establishments have completed in shutdown, which ensures all scheduled callbacks are run to completion (improving diagnostics, preventing memory leaks).
- related to
-
SERVER-92569 Add CancellationToken support to AsyncDBClient
- Closed