Passing the ConnectionMetrics by raw pointer into TransportLayerASIO::asyncConnect can cause a use-after-free situation when the TLConnection that owns the ConnectionMetrics is freed before the DNS resolution callback is called.
The solution is to pass ConnectionMetrics by shared pointer. Since TLConnection is already managed by a shared pointer, we can pass its ConnectionMetrics as a shared pointer using the aliasing constructor.
- is depended on by
-
SERVER-70771 Invariant failure in ConnectionMetrics
- Closed