---
title: "Short note: Distributed debugging"
subject: "Distributed System"
chapter: 5
key: "semester_7/distributed_system:distributed-debugging-note"
source: https://www.bctengineer.com/q/semester_7/distributed_system/distributed-debugging-note
site: BCT Engineering
---

# Short note: Distributed debugging

Distributed System · Chapter 5: Time and State in Distributed Systems

- Asked in: 2071 Shrawan, 4 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/distributed-debugging-note
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-5

## Question

Write a short note on distributed debugging.

## Short answer

Distributed debugging evaluates global predicates (e.g., mutual exclusion violation, deadlock) on consistent global states collected via logical clocks or snapshots. It checks 'possibly Φ' (some consistent state satisfies Φ) or 'definitely Φ' (all linearizations have such a state). Challenges include probe effect, non-determinism, and lack of global time.

## Answer

Distributed debugging means finding errors in programs running on several machines, where there is no global clock and events happen concurrently, so a bug may depend on a particular interleaving of events.

Main ideas:
- **Global state predicates**: the debugger evaluates a condition on the global state, e.g. "two processes are in the critical section" (a safety fault), "the system is deadlocked" or "the lock token is lost".
- **Consistent global states**: the monitor collects local states with vector or Lamport timestamps from all processes and forms consistent cuts. It need not stop the system; Chandy-Lamport snapshots can be used.
- **Possibly Φ**: there is some consistent global state, on at least one possible ordering (linearisation) of the observed execution, in which predicate Φ is true. **Definitely Φ**: on every possible ordering of the observed execution, Φ is true in some consistent global state.
- **Techniques**: logging with timestamps, message tracing, replay of a recorded execution, and breakpoints with causal ordering.
- **Difficulties**: the probe effect (monitoring changes timing), non-determinism, large amounts of trace data, and the absence of a global clock.

Detecting stable predicates (once true, they stay true: deadlock, termination) is easy with a snapshot; unstable predicates need examination of the lattice of consistent states.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Why is distributed debugging hard?
   A. Programs run on one machine
   B. There are no bugs
   C. No global clock and concurrent events make bugs depend on interleavings
   D. Time is perfectly synchronised
   Answer: C. Non-determinism and lack of global time complicate debugging. (Key point: Challenge)

2. What does 'Definitely Phi' mean?
   A. Phi is true in the current state only
   B. There is some execution where Phi holds
   C. Phi never holds
   D. Phi is true in some state on every execution path
   Answer: D. Possibly: some consistent execution; definitely: every path. (Key point: Possibly vs definitely)

3. Why are stable predicates easy to detect?
   A. Once true they stay true, so a snapshot suffices
   B. They change constantly
   C. They need a physical clock
   D. They apply only to one process
   Answer: A. Deadlock and termination stay true, so a snapshot can see them. (Key point: Stable predicate)

4. What is the probe effect?
   A. Loss of messages
   B. Monitoring changes the timing and behaviour of the system
   C. Increase in clock drift
   D. Reduction in trace data
   Answer: B. Instrumenting may hide or alter bugs. (Key point: Probe effect)

## Related in Distributed System

- [State recording, debugging, distributed cuts](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Astate-recording-cut) — Distributed System, chapter 5
