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

Shutdown in mongos can trigger BatchWriteOp invariant

    • Fully Compatible
    • ALL
    • v4.0, v3.6
    • Hide

      Taken from SERVER-40184:

      1. startTransaction in session 0
      2. execute insertOne on collection
      3. startTransaction in session 1
      4. execute insertOne on collection (WriteConflict error expected)
      Taken from SERVER-40184 : startTransaction in session 0 execute insertOne on collection startTransaction in session 1 execute insertOne on collection (WriteConflict error expected)
    • Sharding 2019-05-06
    • 5

      Invariant failure _targeted.empty() src\mongo\s\write_ops\batch_write_op.cpp 255


      1. ARS next calls makeProgress, calls pop and this can cause it to throw shutdownInProgress if no response has been pushed for remote.
      2. This will get caught and cancel all the pending requests. However, what this actually does is mark the task as 'cancelled' and tell the task executor to schedule them right away. Or, in the worse case when the executor is in shutdown, it might just get ignored.
      3. Right before the task executor is able to actually cancel and push the response, if ARS calls makeProgress again, it will trigger the shutdownInProgress error again, exiting the next() call and trigerring the destructor of BatchWriteOp with _targeted not fully consumed.

            blake.oler@mongodb.com Blake Oler
            randolph@mongodb.com Randolph Tan
            0 Vote for this issue
            7 Start watching this issue