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

Convert all owning references of TaskExecutor and ThreadPoolTaskExecutor to use shared_ptr

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • Fully Compatible

      SERVER-92570 and SERVER-92820 asks to futurize NetworkInterfaceTL's setAlarm and command scheduling methods. Because these will now return SemiFuture, ThreadPoolTaskExecutor will need to chain their continuations onto an executor, preferably itself via .thenRunOn(shared_from_this). We can't do this safely currently because ThreadPoolTaskExecutor, and more generally TaskExecutor, instances are sometimes created/owned by unique_ptr, which means that shared_from_this could fail.

      These tickets can be resolved in the meantime with unsafeToInline and then having the continuations schedule the actual work on the ThreadPoolTaskExecutor but this is awkward because there are two schedules that occur for each operation and undesirable since it steals some, albeit not an excessive amount, of execution resources from the NetworkInterfaceTL.

      We should change all the current unique_ptr references to TaskExecutor to shared_ptr ones so that we can safely use shared_from_this in TaskExecutor.

            Assignee:
            Unassigned Unassigned
            Reporter:
            james.bronsted@mongodb.com James Bronsted
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: