Products › lamco-dbus-tools › Use cases

A slow D-Bus call's tail caught in CI: The median didn't move

A slow D-Bus call's tail caught in CI: A 99th percentile limit, at the caller with dbusdo and at the bus with dbustell, fails the job though the median held.

A new version of a service passes its tests and its median barely moves, but one call in fifty makes a user wait. lamco-dbus-tools caught it with dbussee, which recorded the job's bus, dbusdo, which timed 500 calls at the caller, and dbustell, which timed them at the bus, both failing the job at the 99th percentile.

Written by readme.py from a real run on 2026-12-01 on Debian 13, each job under dbus-run-session with a bus of its own (dbus-daemon 1.16.2), with a development build of lamco-dbus-tools, version 0.1.0; first written with an earlier build and run again for the final one. The service is made up for this page, not a real one: catalog.py. The job is ci.sh; every output quoted is in the use case's directory.

The change

Version 2 of a catalog service rebuilds its index every 50 lookups, which takes 30 ms. It passes its own tests, and a check on the average or the median would pass it too. One lookup in fifty, a user waits.

The job

python3 catalog.py "$VERSION" &
dbussee --quiet record --service com.example.Catalog --duration 4 --out "rec-v$VERSION.json" &
dbusdo --out "acts-v$VERSION.json" call --repeat 500 --max-p99 10 \
  com.example.Catalog /com/example/Catalog com.example.Catalog.Lookup s widget
dbustell timing "rec-v$VERSION.json" --by method --max-p99 10 --junit "timing-v$VERSION.xml"
dbustell health "rec-v$VERSION.json" --junit "health-v$VERSION.xml"
dbustell findings "rec-v$VERSION.json" --junit "findings-v$VERSION.xml"
dbustell signals "rec-v$VERSION.json" --top 3

Run as dbus-run-session -- ./ci.sh VERSION, so the job has a bus of its own and touches no one else's. The limit is 10 ms at the 99th percentile, checked twice: At the caller, by dbusdo, which is what a client waits; and at the bus, by dbustell from a recording, from the bus passing the call on to its passing the answer back, which holds the service's work.

Version 1

500 calls, 500 answered, 0 not with a reply. At the caller: min 100.62 µs, median 131.72 µs, 95th 167.94 µs, 99th 186.69 µs, max 689.12 µs
-            com.example.Catalog.Lookup     500      0   66.55 µs    96.8 µs  127.08 µs  144.81 µs  636.01 µs
1 group with answered calls, each within the limit of 10.00 ms at the 99th percentile.
dbusdo exit 0, dbustell timing exit 0

Version 2

500 calls, 500 answered, 0 not with a reply. At the caller: min 110.32 µs, median 145.27 µs, 95th 203.12 µs, 99th 30.30 ms, max 30.40 ms
call --repeat 500 --max-p99 10 ...: the 99th percentile at the caller, 30.30 ms, is over the limit of 10.00 ms (500 calls)
-            com.example.Catalog.Lookup     500      0   76.06 µs  102.18 µs  149.73 µs   30.28 ms   30.38 ms
Over the limit of 10.00 ms at the 99th percentile, 1 of 1 group:
  com.example.Catalog.Lookup: 30.28 ms (500 answered calls)
dbusdo exit 1, dbustell timing exit 1

The median at the caller went from 131.72 µs to 145.27 µs, and the 95th percentile from 167.94 µs to 203.12 µs: Noise. The 99th went from 186.69 µs to 30.30 ms. Both programs fail the job, and the JUnit report names the method:

<testsuite name="dbustell timing" tests="1" failures="1">
  <testcase name="com.example.Catalog.Lookup">
    <failure message="99th percentile 30.28 ms over the limit of 10.00 ms (500 answered calls)">...</failure>
  </testcase>
</testsuite>

The rest of the recording

The same recording gives the job its health and findings as JUnit reports, a case for each finding, a problem failing its case and a notice not; the commands themselves exit 0, having done their job, and it's the report a CI system reads that fails the build. Here only a notice:

<testsuite name="dbustell findings" tests="1" failures="0">
  <testcase name="BUS-003 This dbus-daemon has the monitoring flaw fixed in 1.16.4"/>
</testsuite>

And the signals the job saw, the busiest first:

3 signals in 4.3 s, 2 kinds by sender, member and path. A storm is 100 or more of one kind in one second.

SENDER                SIGNAL                                   COUNT     PER S    PEAK  PATH
org.freedesktop.DBus  org.freedesktop.DBus.NameOwnerChanged        2      0.46       2  /org/freedesktop/DBus
org.freedesktop.DBus  org.freedesktop.DBus.NameLost                1      0.23       1  /org/freedesktop/DBus

Nothing but the bus's own: A change that started broadcasting would show here, and SIG-001 would name a storm.

Choosing the limit

  • The 99th percentile needs enough calls to mean something. The toolkit takes the nearest rank: Of 500 calls it's the 495th, the sixth slowest; with fewer than 100 it's the slowest single call.
  • A limit well above what the service normally takes, here 10 ms against under a quarter of a millisecond at the caller, keeps a loaded CI machine from failing a good build.
  • dbusdo's figure holds both trips across the socket; dbustell's, from the recording, holds the bus and the service. A limit on one is a limit on what that one measures.

What made it catchable

  • A distribution, not an average: One call in fifty hides in every summary but the tail.
  • An exit status and a JUnit report a CI system already reads.
  • A bus of the job's own, so nothing else on the machine moves the figures.

Related