Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-93646

ConnectionPoolTL shutdown should interrupt pending connection establishment

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 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

      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).

            Assignee:
            Unassigned Unassigned
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: