We currently convert all errors encountered during connection-setup to HostUnreachable, which causes the connection-pool to tag the target host as unhealthy and drop all connections (see below for more details). This behavior is not correct for all errors (e.g., EINPROGRESS) and the error-handling code should be adjusted accordingly. A possible solution is to only drop connections for a specific group of errors that are a clear indication that the target host is unhealthy.
Here is the path through which we convert all connection setup errors to HostUnreachable:
- To setup a new connection, the connection pool uses AsyncDBClient, and then converts all errors to HostUnreachable.
- The error is then used to emplace the promise constructed by TLConnection::setup.
- The error is then passed to the callback provided by the connection pool.
- That error is then passed to finishRefresh, and then to processFailure.
- Finally, this causes the connection pool to mark the host as unhealthy and drop all connections (see here).