-
Notifications
You must be signed in to change notification settings - Fork 27
Description
When the service's directory is removed and recreated, like during an xbps package reinstall, runsv
will enter a broken state. Once in that state, a command to down the service will cause runsv
to terminate the supervised process, but will fail to update the status file and possibly more, soft-locking.
The same bug happens for the log service if present, but presence of a log service is not needed.
Minimal reproducer
This can be done as a normal user
-
Have a
<service>
directory containing solely a run file and asupervise -> ../supervise
symlink.#!/bin/sh exec 2>&1 exec <some command here>
-
From the parent directory, run
runsv <service>
-
Copy delete, and recreate
<service>
-
From the same dir as step 2, run
SVDIR=$(pwd) sv stop <service>
-
The supervised process will stop but the
sv
command will fail on timeout, reporting the supervised process' PID as the one it had before being terminated.
Repeating thestop
command will continue to fail and report that same invalid PID.
Trying to start the service will immediately 'succeed', reporting the same PID.
I recommend using as the supervised process a program that outputs frequently, makes it easier to see when the supervised process is running/stopped. I using a simple binary that prints an incremented number each second.