AsyncWorkScheduler use-after-free when destroyed during scheduleRemoteCommand

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 9.1.0-rc0, 9.0.0-rc3
    • Affects Version/s: None
    • Component/s: None
    • None
    • Replication
    • Fully Compatible
    • ALL
    • v9.0
    • Repl 2026-08-03
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In AsyncWorkScheduler::scheduleRemoteCommand's remote path (_targetHostAsync(...).then(...)), the targeting handle is drained before the .then continuation registers the command handle. In that gap the scheduler looks idle (_quiesced() is transiently true), so a waiting join() returns and the owner can destroy the scheduler while the .then continuation still holds a raw this, causing a use-after-free. This is a flaw in AsyncWorkScheduler's teardown bookkeeping, not in the executor's TaskExecutor::scheduleRemoteCommand primitive.

      Only Windows debug builds crash on it, via the iterator check that fired the reported assertion. On Linux the bad access is silent unless built with ASAN.

            Assignee:
            Denis Trailin
            Reporter:
            Denis Trailin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: