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

Pass ConnectionMetrics by shared_ptr

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc3, 6.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v6.1
    • Hide

      Reproduced by BF-26305. Can be reliably reproduced if an artificial delay is introduced inside the DNS resolution callback before the ConnectionMetrics is accessed.

      Show
      Reproduced by BF-26305. Can be reliably reproduced if an artificial delay is introduced inside the DNS resolution callback before the ConnectionMetrics is accessed.
    • Service Arch 2022-09-19, Service Arch 2022-10-03
    • 148

      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.

            Assignee:
            vojislav.stojkovic@mongodb.com Vojislav Stojkovic
            Reporter:
            vojislav.stojkovic@mongodb.com Vojislav Stojkovic
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: