Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1269

Ctrl+C during transaction can hard quit mongosh

    • Type: Icon: Investigation Investigation
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Shell API
    • None

      • Connect to replset
      • Run test script below
      • Hit Ctrl+C

      Intermittently, mongosh will abort with

      MongoRuntimeError: Attempted illegal state transition from [TRANSACTION_COMMITTED] to [TRANSACTION_ABORTED]
          at Transaction.transition (/usr/bin/mongosh:52355:11)
          at commandHandler (/usr/bin/mongosh:52955:27)
          at /usr/bin/mongosh:53024:5
          at /usr/bin/mongosh:46751:9
          at /usr/bin/mongosh:48318:9
          at /usr/bin/mongosh:72737:13
          at /usr/bin/mongosh:73686:9
          at handleOperationResult (/usr/bin/mongosh:73903:12)
          at Connection.onMessage (/usr/bin/mongosh:70525:11)
          at MessageStream.<anonymous> (/usr/bin/mongosh:70349:56) {
        [Symbol(errorLabels)]: Set(0) {}
      }
      

      Test script:

      while (true) { db.test.deleteMany({}); S = db.getMongo().startSession(); S.startTransaction(); D=S.getDatabase('test'); D.test.insertOne({x:1}); D.test.insertOne({x:2}); S.commitTransaction(); S.endSession(); count = db.test.countDocuments(); print(count); if (count != 2) { break; } }
      

      (The exact script probably does not matter, but this is what I reproduced this with right now)

            Assignee:
            Unassigned Unassigned
            Reporter:
            anna.henningsen@mongodb.com Anna Henningsen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: