Course contentsShow
← Computer Science
Lesson 2719 of 2,87260. Distributed Data and CommunicationFree lesson

2PC Failure Modes and Blocking

Understanding coordinator failures, participant crashes, network partitions, and why 2PC can block indefinitely.

2PC Failure Modes and Blocking

What you'll learn: Why Two-Phase Commit can get stuck waiting forever when failures occur, leaving transactions in limbo.

The Blocking Problem

While Two-Phase Commit ensures atomic commits across distributed nodes, it has a critical weakness: it can block indefinitely when certain failures occur. Blocking means participants are left holding locks on resources, unable to commit or abort, waiting for a coordinator that may never respond.

Coordinator Failures

If the coordinator crashes after sending prepare requests but before sending commit/abort decisions, participants are stuck in an "uncertain" state. They've voted YES and are waiting, but have no way to proceed safely. They can't unilaterally commit (other participants might have voted NO), and they can't abort (that might violate atomicity if others commit). The transaction is blocked until the coordinator recovers.

Think of it like a group deciding on dinner: everyone said "yes" to pizza, but the person collecting votes disappeared. No one can order without risking someone else ordering something different.

Participant Crashes

If a participant crashes after voting YES but before receiving the final decision, recovery is tricky. The participant must wait to learn the outcome—it cannot decide independently. Other participants may be blocked waiting for this node to acknowledge the commit.

Network Partitions

Network partitions are particularly nasty. If the coordinator is isolated from some participants, those participants can't receive the final decision. They remain blocked, holding locks, even though the coordinator and other participants may have successfully completed the transaction on the other side of the partition.

Unlike Three-Phase Commit (which we've covered), 2PC has no timeout-based recovery that preserves correctness—participants must wait for coordinator recovery or manual intervention.

Key Takeaway: Two-Phase Commit can block indefinitely during coordinator failures or network partitions, because participants in the "prepared" state cannot safely make unilateral decisions without risking atomicity violations.