summaryrefslogtreecommitdiff
path: root/src/readahead-common.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2011-12-03 02:13:30 +0100
committerMichal Schmidt <mschmidt@redhat.com>2011-12-03 21:50:27 +0100
commit3a11183858af30bc9b4e9dac430dd7541deec19b (patch)
treee691cc4eb945d292ac889dcb4c820af9538415d0 /src/readahead-common.c
parente92238567b9fc83ef77e359588d7b005ecae3d70 (diff)
service: handle services with racy daemonization gracefully
There are a lot of forking daemons that do not exactly follow the initialization steps as described in daemon(7). It is common that they do not bother waiting in the parent process for the child to write the PID file before exiting. The daemons' developers often do not perceive this as a bug and they're unwilling to change. Currently systemd warns about the missing PID file and falls back to guessing the main PID. Being not quite deterministic, the guess can be wrong with bad consequences. If the guessing is disabled, determinism is achieved at the cost of losing the ability of noticing when the main process of the service dies. As long as it does not negatively affect properly written services, systemd should strive for compatibility even with services with racy daemonization. It is possible to provide determinism _and_ main process supervision to them. If the PID file is not there, rather than guessing and considering the service running immediately after getting the SIGCHLD from the ExecStart (or ExecStartPost) process, we can keep the service in the activating state for a bit longer. We can use inotify to wait for the PID file to appear. Only when it finally does appear and we read a valid PID from it, we'll move the service to the running state. If the PID file never appears, the usual timeout kicks in and the service fails.
Diffstat (limited to 'src/readahead-common.c')
0 files changed, 0 insertions, 0 deletions