diff --git a/05.deployment/10.hang-watchdog/default.md b/05.deployment/10.hang-watchdog/default.md new file mode 100644 index 0000000..693aeda --- /dev/null +++ b/05.deployment/10.hang-watchdog/default.md @@ -0,0 +1,93 @@ +--- +title: "Hang Watchdog" +published: true +visible: true +taxonomy: + audience: [webmaster, developer] + difficulty: [intermediate] + topic: [deployment, operations] +metadata: + description: "How Dune detects a blocked event loop, what it does about it, and how to keep it from killing legitimate work" +--- + +# Hang Watchdog + +Dune serves every request on one thread. If a synchronous loop gets stuck on that thread (catastrophic regex backtracking, a conversion that never terminates), the server stops answering **every** URL at once, logs nothing, and stays that way until someone restarts it. A blocked thread can't rescue itself, so `dune dev` and `dune serve` run a small watchdog on a separate thread. + +## What it does + +The main thread sends the watchdog a heartbeat every second. If the heartbeats stop for longer than the limit, the watchdog: + +1. writes a report to `/.dune/hangs/hang-