mbox series

[v2,0/3] prserv: add --status, and make --start notice a dead server

Message ID 20260915160633.7-1-bbnpreetsingh@gmail.com
Headers show
Series prserv: add --status, and make --start notice a dead server | expand

Message

Babanpreet Singh Sept. 15, 2026, 4:06 p.m. UTC
v1 of --status failed bitbake-selftest on the autobuilder: test_2 found
a stale pidfile for the server test_1 had just started. The daemon dies
somewhere between writing its pidfile and serving, and --start cannot
tell, because it returns once the intermediate fork exits. The old
start/stop pair never noticed a dead server since --stop treats a stale
pidfile as success. Every autobuilder run that carried v1 failed the
same way (26 runs on 20 workers, on Richard's and Mathieu's
master-next) while it passes here. Binding 8585 before --start gives
the identical symptom, but the workers' prserv.log is not published so
I do not know what kills it there.

1/3 ScriptTests picks a free port and keeps one database directory
    for the class instead of 8585 and a directory per test.
2/3 --start waits until the daemon has bound and opened its database,
    and exits 1 with the daemon's error and the logfile path if it
    fails first. The daemon removes its pidfile on failure. New test:
    --start on a busy port fails and leaves no pidfile.
3/3 --status, as in v1, with the tests on the class port.

If the daemon still dies on the autobuilder, test_1 fails with the
reason in the log rather than test_2 with a stale pidfile.

Tested on top of 046a90b0e: prserv.tests 10/10 at the tip and at each
intermediate commit, ScriptTests 20 runs in a row clean, and the rest of
bitbake-selftest module by module with BB_SKIP_NETTESTS=yes, all OK
except hashserv.tests, which hangs on this host with or without these
patches.

Babanpreet Singh (3):
  prserv/tests: run ScriptTests on a free port with one database
  prserv: make --start fail when the server does not come up
  prserv: add --status to list running servers

 bin/bitbake-prserv  |  7 +++++
 lib/prserv/serv.py  | 76 ++++++++++++++++++++++++++++++++++++++++-----
 lib/prserv/tests.py | 54 +++++++++++++++++++++++++++-----
 3 files changed, 122 insertions(+), 15 deletions(-)