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

Abandoned cursor in a transaction can block other operations

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 4.0.0-rc0
    • Component/s: Concurrency, Querying
    • None
    • Replication
    • ALL
    • Hide

      Download the attached 'repro.js', then run:

      python buildscripts/resmoke.py --suites=replica_sets_jscore_passthrough repro.js

      That will hang forever.

      Show
      Download the attached 'repro.js', then run: python buildscripts/resmoke.py --suites=replica_sets_jscore_passthrough repro.js That will hang forever.

      Suppose a transaction opens a cursor, then abandons it. The locks for that cursor will be held in intent mode, even between batches.

      Now suppose a drop for the database or collection comes in. That drop will "get in line" with a MODE_X lock. In order to be fair to such requests, that pending MODE_X acquisition will block all future intent acquisitions. 

      This will prevent a killCursors from killing the cursor, since it will need to take a collection lock. It looks like it will also prevent the background transaction timeout job from killing it.

        1. repro.js
          2 kB
          Charlie Swanson

            Assignee:
            backlog-server-repl [DO NOT USE] Backlog - Replication Team
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: