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

make TaskExecutor::cancel return whether the task was successfully canceled

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Works as Designed
    • 3.4.0-rc0
    • None
    • Networking
    • None
    • Fully Compatible
    • Platforms 2016-10-31

    Description

      In at least one case (SERVER-26524), we had to add a brittle workaround because canceling a task does not guarantee that CallbackCanceled is delivered to the callback (if the task completes before cancel() is called, the actual response will be delivered instead).

      I see how it's difficult to directly return whether CallbackCanceled will be delivered since the task is canceled by post()'ing to the asio::io_service::strand:

      https://github.com/mongodb/mongo/blob/r3.4.0-rc0/src/mongo/executor/thread_pool_task_executor.cpp#L360 ->
      https://github.com/mongodb/mongo/blob/r3.4.0-rc0/src/mongo/executor/network_interface_asio.cpp#L427 ->
      https://github.com/mongodb/mongo/blob/r3.4.0-rc0/src/mongo/executor/network_interface_asio_operation.cpp#L114-L122

      but perhaps a blocking version of TaskExecutor::cancel (or a flag that indicates whether it should block) could be added?

      Attachments

        Issue Links

          Activity

            People

              jason.carey@mongodb.com Jason Carey
              esha.maharishi@mongodb.com Esha Maharishi
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: