Papers
Topics
Authors
Recent
Search
2000 character limit reached

DDMon: Distributed Deadlock Monitoring

Updated 9 July 2026
  • DDMon is a distributed deadlock monitoring framework that detects wait-for cycles in single-threaded RPC systems via a probe-chasing algorithm.
  • The framework employs decentralized proxy monitors that observe message exchanges without modifying service code, ensuring transparency and precision.
  • Formal guarantees of soundness and completeness are established through Coq mechanisation and rigorous empirical evaluations on Erlang/OTP applications.

DDMon, the Distributed Deadlock MONitoring framework, is a distributed black-box runtime approach for detecting deadlocks in concurrent and distributed RPC-based systems by deploying monitors alongside each service, observing only incoming and outgoing messages, and exchanging probes with other monitors (Rowicki et al., 20 Aug 2025). It is presented together with a formal model of SRPC (“single-threaded RPC”) services, a distributed black-box monitoring algorithm that is proved sound and complete—that is, it identifies deadlocked services with neither false positives nor false negatives—and an implementation for Erlang/OTP applications. The work also states that this is the first formalisation, correctness proof, and implementation of distributed black-box monitors for deadlock detection, and that the results are mechanised in Coq (Rowicki et al., 20 Aug 2025).

1. Problem setting and design objectives

DDMon is motivated by the structure of modern microservice and RPC-based systems in which individual services invoke each other in chains of remote procedure calls while each service is typically single-threaded, processing one request at a time and blocking on each RPC until its peer replies. In that setting, circular call chains can arise so that service S1S_1 waits for S2S_2, S2S_2 waits for S3S_3, and SnS_n waits for S1S_1. Such wait-for cycles deadlock the involved services, and blocking propagates outward as other services stall waiting on the original victims (Rowicki et al., 20 Aug 2025).

The framework is designed for environments in which static analysis is inadequate because systems span language barriers, closed-source components, and heterogeneous frameworks. The data explicitly contrasts this with monolithic static analysis, which may be infeasible and must trade false positives for decidability. DDMon instead adopts a distributed black-box approach with four stated properties: it is distributed, so there is no central coordinator; black-box, because monitors only observe message sends and receives; transparent, because monitors do not change service behavior; and precise, because they detect deadlocks soundly and completely (Rowicki et al., 20 Aug 2025).

A central misconception that DDMon directly rejects is that accurate distributed deadlock detection necessarily requires source instrumentation, inlining, or a central bottleneck. The framework is explicitly presented as lightweight, black-box, and decentralized. Its objective is not approximate anomaly detection, but precise identification of real deadlocks in running systems.

2. SRPC model, locks, and deadlocks

The formal substrate of DDMon is the model of SRPC services, described as “single-threaded RPC” services and exemplified by Erlang/OTP gen_server or actor-based services. An SRPC service is written as

$\ser = \langle Q_\mathsf{in},\,P,\,Q_\mathsf{out}\rangle$

where QinQ_\mathsf{in} and QoutQ_\mathsf{out} are FIFO-selective queues of messages $\msg{n}{\mathsf{q}/\mathsf{r}/\mathsf{c}}$, and S2S_20 is the internal state (Rowicki et al., 20 Aug 2025).

The service discipline is sequential. In state S2S_21, the process must dequeue a query or cast and move to S2S_22. In S2S_23, it may emit internal S2S_24 actions, casts, and queries S2S_25, then block in S2S_26 until S2S_27. After S2S_28, it replies to client S2S_29 unless S2S_20 for casts, and returns to S2S_21. This captures the gen_server or actor RPC pattern that the monitoring algorithm targets (Rowicki et al., 20 Aug 2025).

A network S2S_22 is a mapping from service names to SRPC services. Its labeled transitions S2S_23 are divided into two classes. Internal transitions, with S2S_24, arise from a service’s internal S2S_25, send, or receive steps. Communication transitions, with S2S_26 for S2S_27, denote a query or response sent by S2S_28 and enqueued into S2S_29. Paths are written S3S_30 (Rowicki et al., 20 Aug 2025).

The deadlock semantics are likewise explicit. A service S3S_31 is locked on S3S_32 when its process state is S3S_33, S3S_34 is empty, and S3S_35 lacks any pending S3S_36. A deadlocked set S3S_37 is a nonempty set of names such that each S3S_38 is locked on some S3S_39. A network has a deadlock if it contains any such set. The report further states, by Lemma 2.7, that once a deadlock arises it is persistent: no further execution can break it unless some blocked reply arrives, which cannot happen among the locked loop (Rowicki et al., 20 Aug 2025).

This persistence property is significant for DDMon because it turns deadlock detection into a problem of discovering an already-stable wait-for cycle rather than predicting a transient condition. The monitoring algorithm exploits exactly that stability.

3. Proxy monitors and the probe-chasing algorithm

DDMon instruments each service with a proxy monitor: SnS_n0 where SnS_n1 is the monitor’s internal state and SnS_n2 buffers both observed service messages and inter-monitor probes. Monitor behavior is driven by a total function

SnS_n3

Incoming service messages and probes are enqueued, then dequeued and fed to handle, which may emit zero or more outgoing probes SnS_n4 to other monitors (Rowicki et al., 20 Aug 2025).

The monitor state records three fields: probe, the current active probe SnS_n5 or ; waiting, a set of peer names whose queries are currently in flight; and alarm, a Boolean flag. The operational logic is deliberately minimal. Whenever the monitored service sends a query to SnS_n6, the monitor draws a fresh probe SnS_n7 and sets probe := p. Whenever it receives a response, it sets probe := ⊥. Whenever it sees an incoming query SnS_n8, it records waiting ∪= {n}, and if probe ≠ ⊥, it immediately emits SnS_n9 (Rowicki et al., 20 Aug 2025).

Upon an incoming probe S1S_10, the monitor performs one of three actions:

  • Origin detection: if probe = p, then alarm := true.
  • Silent drop: if probe = ⊥, the probe is dropped.
  • Backward forwarding: otherwise, the probe is forwarded to every S1S_11.

The report characterises this as backward-chasing along the SRPC “wait-for” edges. The essential handle equations are given as follows: S1S_12 As soon as any monitor’s alarm flips to true, DDMon declares a deadlock and reports the concrete set of service names that forwarded the critical probe (Rowicki et al., 20 Aug 2025).

The importance of this construction is that it does not require monitors to inspect service code or reconstruct global control flow. Probe circulation is sufficient because the SRPC discipline constrains the shape of dependencies: a service is either waiting for a reply or not, and monitor-local knowledge of waiting and probe is enough to recover a deadlocked cycle.

4. Correctness criteria and Coq mechanisation

DDMon’s formal guarantees are split into two orthogonal criteria. The first is Transparency (Criterion 2.1), formulated as an operational correspondence between the original network and the instrumented one. Completeness of transparency means that every unmonitored step S1S_13 lifts to some monitored path S1S_14 with S1S_15. Soundness of transparency means that monitored execution introduces no extra behaviors: every monitored path can be flushed by a few extra steps that simply deliver buffered messages back to some unmonitored step. The proofs proceed by induction on transition paths and use queue-filtering lemmas (Rowicki et al., 20 Aug 2025).

The second criterion is Detection Preciseness (Criterion 2.2). In any instrumented execution S1S_16, the report states both:

  • Soundness: if any monitor’s alarm=true, then the underlying unmonitored network S1S_17 indeed contains a deadlocked set.
  • Completeness: if S1S_18 has a deadlock, then from S1S_19 there is some finite continuation, obtained by flushing probes and exchanging messages, after which alarm must flip true (Rowicki et al., 20 Aug 2025).

Three invariants are identified as the main proof drivers: SRPC well-formedness, complete lock knowledge, and sound lock knowledge. SRPC well-formedness states that no service replies without a corresponding query and that mailbox and process state remain in sync. Complete lock knowledge states that no locked service ever goes un-probeed. Sound lock knowledge states that a non- probe always corresponds to a genuine lock (Rowicki et al., 20 Aug 2025).

The central combined result is Theorem 5.17: $\ser = \langle Q_\mathsf{in},\,P,\,Q_\mathsf{out}\rangle$0 An eventual-reporting refinement, Theorem 5.18, uses a lexicographic measure on pending probe-forwards together with a fairness assumption so that the report must actually occur in any fair run (Rowicki et al., 20 Aug 2025).

All semantic definitions, inductive invariants, and theorems are fully formalised in Coq 8.20. The mechanisation is structured into SRPC.v, Monitor.v, Algorithm.v, and Proofs.v. The report lists induction on LTS paths, custom Ltac inversion_path, simulation relations for operational correspondence, FSets-based finite set reasoning on waiting, and lexicographic measures using the standard Coq Compare module as key proof techniques. The mechanisation is associated with Zenodo 10.5281/zenodo.16909482, checks in under 5 KLOC, and scripts reproduce all proofs (Rowicki et al., 20 Aug 2025).

5. Erlang/OTP implementation and integration model

The prototype tool DDMon targets Erlang and Elixir applications using the OTP gen_server behaviour. Integration is presented as a drop-in replacement.

In Elixir: $\ser = \langle Q_\mathsf{in},\,P,\,Q_\mathsf{out}\rangle$1

In Erlang: $\ser = \langle Q_\mathsf{in},\,P,\,Q_\mathsf{out}\rangle$2

When DDMon starts, it spawns the real gen_server as a private child and returns the monitor PID to the application. All incoming requests first reach the monitor, which inspects them, enqueues them into its own mailbox, applies the handle logic to record waiting sets and emit probes, and then forwards them to the real service. Responses pass back through the monitor symmetrically. Probes are represented as tiny Erlang terms consisting of an integer tag plus the list of intermediates, which supports user-friendly reporting of the deadlocked set (Rowicki et al., 20 Aug 2025).

The implementation exposes deadlocks through concise logs such as: $\ser = \langle Q_\mathsf{in},\,P,\,Q_\mathsf{out}\rangle$3 and, in the usage section, $\ser = \langle Q_\mathsf{in},\,P,\,Q_\mathsf{out}\rangle$4 The reported set is described as precisely the services in the true wait-for cycle (Rowicki et al., 20 Aug 2025).

The operational integration procedure is also explicit: replace gen_server with ddmon, recompile without changing existing service code, optionally configure a probe delay via DDMon.set_probe_delay(1000) for a 1 s window, and run the application. The report states that DDMon may be toggled at runtime because it is fully transparent; removing DDMon restores the original message rates exactly (Rowicki et al., 20 Aug 2025).

6. Empirical evaluation, scope, and limitations

The evaluation uses synthetic benchmarks of randomly generated gen_server networks of up to 11 000 services. The reported overhead depends strongly on probe timing. With eager probe emission, service-to-service messages increase by approximately 100 %. With delayed emission using a 1 s timeout, that overhead drops to below 5 % for large systems because most probe candidates are cancelled by quick replies. When monitor-service forwarding is included, total messages triple, but each such send/receive occurs in RAM in the same Erlang VM and costs about 0.2 μs. Throughput benchmarks are said to confirm that, for typical workloads, end-to-end latency increases by under 2 % in the delayed setting. Under real traffic patterns, deadlocks are detected within tens of milliseconds after the cycle closes (Rowicki et al., 20 Aug 2025).

These measurements define the practical scope of DDMon. It is intended for SRPC patterns such as gen_server and gen_statem, where a black-box message-trace view is sufficient for exact reasoning about lock propagation. The framework does not yet support several cases listed in the report: AND-vs-OR RPC models, RPC timeouts that are invisible to pure message-trace monitoring unless services announce them to their proxy, a fully mechanised treatment of the fairness assumption behind eventual reporting, and cross-language deployments beyond the current Erlang-native implementation (Rowicki et al., 20 Aug 2025).

A plausible implication is that DDMon’s strongest guarantees depend on the alignment between the monitored runtime and the SRPC semantics formalised in the technical report. Within that scope, the framework combines distributed deployment, black-box observation, proved transparency, proved detection preciseness, Coq mechanisation, and a working Erlang/OTP implementation in a single system (Rowicki et al., 20 Aug 2025).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to DDMon.