Skip to content

Conversation

agourlay
Copy link
Member

Found by lockbud

[2025-02-13T20:25:26Z WARN  lockbud::callbacks] [
      {
        "ConflictLock": {
          "bug_kind": "ConflictLock",
          "possibility": "Possibly",
          "diagnosis": [
            {
              "first_lock_type": "ParkingLotRead(content_manager::consensus::persistent::Persistent)",
              "first_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:984:13: 984:23 (#0)",
              "second_lock_type": "ParkingLotMutex(content_manager::consensus::consensus_wal::ConsensusOpWal)",
              "second_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:1012:13: 1012:28 (#0)",
              "callchains": []
            },
            {
              "first_lock_type": "ParkingLotMutex(content_manager::consensus::consensus_wal::ConsensusOpWal)",
              "first_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:965:27: 965:42 (#0)",
              "second_lock_type": "ParkingLotRead(content_manager::consensus::persistent::Persistent)",
              "second_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:967:21: 967:43 (#0)",
              "callchains": []
            }
          ],
          "explanation": "Locks mutually wait for each other to form a cycle"
        }
      },
      {
        "ConflictLock": {
          "bug_kind": "ConflictLock",
          "possibility": "Possibly",
          "diagnosis": [
            {
              "first_lock_type": "ParkingLotRead(content_manager::consensus::persistent::Persistent)",
              "first_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:984:13: 984:23 (#0)",
              "second_lock_type": "ParkingLotMutex(content_manager::consensus::consensus_wal::ConsensusOpWal)",
              "second_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:1012:13: 1012:28 (#0)",
              "callchains": []
            },
            {
              "first_lock_type": "ParkingLotMutex(content_manager::consensus::consensus_wal::ConsensusOpWal)",
              "first_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:955:13: 955:22 (#0)",
              "second_lock_type": "ParkingLotRead(content_manager::consensus::persistent::Persistent)",
              "second_lock_span": "lib/storage/src/content_manager/consensus_manager.rs:956:13: 956:23 (#0)",
              "callchains": []
            }
          ],
          "explanation": "Locks mutually wait for each other to form a cycle"
        }
      }
    ]

@agourlay agourlay marked this pull request as ready for review February 13, 2025 20:56
Copy link
Member

@timvisee timvisee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find! Thanks! 🙌

Here's an example where we locked wal first, then persistent:

let wal_guard = self.wal.lock();
let persistent = self.persistent.read();

Your change matches that order 👍

@timvisee timvisee requested a review from ffuugoo February 14, 2025 10:07
@agourlay agourlay merged commit 2381082 into dev Feb 14, 2025
17 checks passed
@agourlay agourlay deleted the fix-deadlock-in-consensus-manger branch February 14, 2025 10:47
timvisee pushed a commit that referenced this pull request Feb 17, 2025
@timvisee timvisee mentioned this pull request Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants