Products › lamco-dbus-tools › Use cases
A dialog that hangs now and then: Catch a D-Bus call with no reply
A dialog that hangs now and then: Catch the D-Bus call that never got a reply after the fact, from the last minutes dbuskeep kept, with dbustell pending.
A program waits now and then for an answer that never comes, and by the time anyone looks it has given up and
nothing is waiting. lamco-dbus-tools caught it with dbussee, which took the moment after it happened,
dbustell, whose pending named the call left unanswered, and dbuskeep, which had kept the
last minutes of the bus.
A real run on 2026-12-01 on Debian 13 against a private dbus-daemon 1.16.2, with a development build of
lamco-dbus-tools, version 0.1.0. run.sh ran it, dialogs.py is the made-up service, not a real
application, run.txt is what it printed, and out/ holds the captures.
The symptom
A program asks a dialog service a question now and then. Most answers come at once; once in a while the program
sits waiting until its own time limit, and by the time anyone looks, it has given up and nothing is waiting any
more. A recording started then would see nothing. dialogs.py does this on purpose: Every third question it
never answers.
Keeping the last minutes
dbuskeep keeps the last minutes of the bus all the time, with one monitor whatever reads from it, so the moment
can be taken after it happened:
$ dbuskeep run --window 120 --held-cap 16 &
dbuskeep: keeping 120.00 s of bus 13f0c425d81de9f113ddd9f76b0ef407 (session), answering at /run/user/1000/lamco-dbus-tools/keep/13f0c425d81de9f113ddd9f76b0ef407.sock
$ dbuskeep status
dbuskeep 0.1.0 (process 2605338) keeps bus 13f0c425d81de9f113ddd9f76b0ef407 (session), at /run/user/1000/lamco-dbus-tools/keep/13f0c425d81de9f113ddd9f76b0ef407.sock: 16 messages, 2341 bytes, the oldest from 1.50 s ago; 16 read since it began, 0 readers now. It keeps 120 s.
--window is how much it keeps, in seconds, and --held-cap the most memory it may hold, in MiB, the oldest let
go first past either. On a desktop it runs as a user's service (running the service).
Taking the moment after it happened
The program asked three questions, and the third hung for its 2 seconds. Then, the last minute of what the service kept, only the dialog service's traffic, taken at once:
$ dbussee record --service com.example.Dialogs --ring 60 --now --after 0 --out ring.json
$ dbustell pending ring.json
Of 18 messages, 1 call was waiting for a reply when it ended:
2.52 s :1.6 -> com.example.Dialogs (:1.2 python3 (2605347))
com.example.Dialogs.Ask on /dialogs, serial 2
--ring 60 --now fires at once on what's kept, --after 0 adds nothing after it, and --service is applied by
the service as the bus would (match rules). The hung call is there, with the
connection that made it and the process that never answered. dbustell timing gives the two that were answered:
$ dbustell timing ring.json --top 3
3 calls asked for a reply: 2 replied, 0 answered with an error, 1 had no answer by the end. 0 asked for none.
...
DESTINATION METHOD CALLS ERR MIN MEDIAN 95TH 99TH MAX
com.example.Dialogs com.example.Dialogs.Ask 3 0 137.71 µs 137.71 µs 448.34 µs 448.34 µs 448.34 µs
Watching it live
While the program asks three more questions, the sixth of which hangs:
$ dbussee watch --service com.example.Dialogs --bodies decoded --duration 3
0.498 signal org.freedesktop.DBus -> - /org/freedesktop/DBus org.freedesktop.DBus.NameOwnerChanged(sss) [:1.9, , :1.9]
0.498 call :1.9 -> com.example.Dialogs /dialogs com.example.Dialogs.Ask(s), serial 2 [question 4]
0.499 return :1.2 -> :1.9 reply to 2 [yes]
...
0.503 call :1.11 -> com.example.Dialogs /dialogs com.example.Dialogs.Ask(s), serial 2 [question 6]
1.504 signal org.freedesktop.DBus -> - /org/freedesktop/DBus org.freedesktop.DBus.NameOwnerChanged(sss) [:1.11, :1.11, ]
11 messages shown. Stopped: the duration ran out.
--bodies decoded shows each message's values: The question asked, the answer given. The sixth question has no
answer, and its caller leaves the bus a second later, when its time limit runs out.
A rule that doesn't take the answers
dbussee pending asks the same of the live bus. Given a rule on the interface, while three more questions are
asked, the ninth of which hangs:
$ dbussee pending --match "interface='com.example.Dialogs'" --duration 3
After listening 3 s to 8 messages, 3 calls were waiting for a reply when it ended:
2.61 s :1.13 -> com.example.Dialogs (:1.2 python3 (2605347))
com.example.Dialogs.Ask on /dialogs, serial 2
2.60 s :1.14 -> com.example.Dialogs (:1.2 python3 (2605347))
com.example.Dialogs.Ask on /dialogs, serial 2
2.60 s :1.15 -> com.example.Dialogs (:1.2 python3 (2605347))
com.example.Dialogs.Ask on /dialogs, serial 2
What this can't see:
...
A call whose reply the recording's rules didn't take looks as if it is waiting. --service and --all take replies; a --match rule may not.
Three are reported where one hung: An answer carries no interface, so a rule on the interface takes the questions
and none of the answers, and each question looks unanswered. The command says so in what it can't see. --service
takes both the calls to a name and what it sends back, which is why the ring above was right.
A recording left running
For a fault that comes once a day, a recording can run until something says stop, written to disk as it's taken:
$ dbussee record --all --stream --size-cap 8 --budget 4 --max-messages 100000 --until-file stop --out long.json
$ dbustell health long.json
Bus (session): dbus-daemon 1.16.2
...
--stream writes each record as it comes, so a long recording costs no memory and survives the recorder being
killed; --size-cap ends it at 8 MiB on disk, --max-messages at 100,000 messages, and --until-file when the
named file appears, here touched by the script after 2 seconds, in practice by whatever notices the fault.
--budget is what may wait for the writer before the recorder lets go rather than make the bus wait for it.
On dbus-broker
dbus-broker never applies a match rule's destination (match rules), and
--service is sender or destination, so there it takes everything. The same dialog service on dbus-broker 37
(broker.sh, broker.txt), with another program broadcasting a clock's ticks meanwhile; first with the
recorder's own monitor, so the bus applies the rule, then through dbuskeep reading the rule as the
specification does:
$ dbussee record --service com.example.Dialogs --no-keep --duration 3 --out broker-bus.json
Note: This bus is dbus-broker, which never applies a rule's destination, so `destination='com.example.Dialogs'` will take messages sent to anyone, and --service everything. With dbuskeep keeping the bus, --rules-as-specified applies it as the specification says.
31 messages recorded. Stopped: the duration ran out.
$ dbussee record --service com.example.Dialogs --rules-as-specified --duration 3 --out broker-specified.json
10 messages recorded. Stopped: the duration ran out.
$ dbustell signals broker-bus.json
20 signals in 3.0 s, 6 kinds by sender, member and path. A storm is 100 or more of one kind in one second.
:1.5 com.example.Clock.Tick 1 0.33 1 /clock
:1.6 com.example.Clock.Tick 1 0.33 1 /clock
:1.7 com.example.Clock.Tick 1 0.33 1 /clock
$ dbustell signals broker-specified.json
8 signals in 3.0 s, 1 kinds by sender, member and path. A storm is 100 or more of one kind in one second.
The bus's reading took the clock's ticks, which have nothing to do with the dialog service, and the recorder said
it would; --rules-as-specified took the dialog service's own traffic. --no-keep gives the recorder a monitor of
its own even with the service running, which is how the bus's reading was asked for here.