LuAITools.com
提交工具
🧲AI
Everyone waits, nobody moves

Deadlock

When several agents each wait on a resource or action held by another, nobody budges and the whole system freezes in place.

What is deadlock?

Two people squeeze into a narrow doorway: one says "you first", the other says "no, you first" — and neither gets through. Deadlock is that, with agents: several of them each wait on a resource or action the other is holding, forming a "you wait, I wait" standstill that never resolves.

How does it happen?

Resources held without release
Agent A locks file X and wants file Y; Agent B locks file Y and wants file X. A waits for B to free Y, B waits for A to free X — a knot.
Waiting on each other to move first
Two agents each wait for the other's reply before continuing, so both just sit there.
Circular dependency
Three or more agents line up in a ring, each waiting on the next, with no way out.

How do you spot it?

The classic signs: a progress bar that stops, logs full of "waiting", requests timing out over and over. Monitoring can build a "who waits on whom" graph and check it for cycles.

How to prevent and break it

Lock in a fixed order
Make every agent request resources in the same order so waits can't cross.
Add timeouts
If you can't get it, give up, retry or escalate — never wait forever.
Force an interrupt
When it's truly stuck, kill one of the waiters to break the loop.
Share less
Let each agent use its own local resources where possible, so there's less to fight over.

Bottom line: deadlock is agents each waiting for the other to go first — and no one moves.

Comments