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

NetworkInterfaceTL can crash during destruction

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • Fully Compatible
    • ALL
    • Service Arch 2024-03-04, Service Arch 2024-03-18
    • 104

      AsioReactor allows tasks to be scheduled even while/after it is stopped. Tasks scheduled during the dropping will be drained, but those scheduled after draining is complete will just never be executed.

      NetworkInterfaceTL schedules work on the reactor after making it a GuaranteedExecutor, so if the above case is ever hit, an invariant will be triggered during the destruction, as the submitted task was never scheduled.

      See BF-31784 for more context.

      To fix this, we can check to see if the reactor has been stopped in AsioReactor::schedule, and if so execute the task with a cancellation status, rather than posting it to the io_context. This is similar to other existing task executors: https://github.com/10gen/mongo/blob/master/src/mongo/executor/network_interface_thread_pool.cpp#L113-L118

            Assignee:
            james.bronsted@mongodb.com James Bronsted
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: