5 ms·
There are race conditions in rc.d. Like most concurrency bugs, they are rare, but we shouldn't ignore them. Consider what happens if you start a process, and t
by oofabz 11y ago
There are race conditions in rc.d. Like most concurrency bugs, they are rare, but we shouldn't ignore them.
Consider what happens if you start a process, and then stop it before its pidfile gets written. Or, if you start a process that takes a while to initialize, and during that time you can't kill it normally. Now imagine combining these situations with auto-restarting daemons that crash, or shutting down a computer immediately after it boots.
The right thing to do in these situations is to block until the daemon gets into its normal run state, when its PID is known and you can kill it safely. rc.d init systems don't do this, they just fire off a signal to a PID and hope for the best. It doesn't always work and on top of that, it's easy to misconfigure something, like a pidfile path or permissions.
- msbarnett 11y ago> There are race conditions in rc.d. Like most concurrency bugs, they are rare, but we shouldn't ignore them. Doesn't systemd have roughly the same problem, with non-deterministic boot order and dependency heuristics resulting in opaque, hard-to-debug ordering issues that appear only intermittently?
- aidenn0 11y agoAny parallel init system will have non-deterministic boot order. This is very different from race conditions. Non-deterministic boot order makes bugs in your dependency system very hard to track down. Some parallel build tools have options to do a non-parallel build, but randomize the order of dependencies. This can help track down failures due to improper dependencies regardless of parallelism available. Race conditions are themselves bugs.
- ausjke 11y agoI wish the various rc.d/* scripts can support real dependency, i.e. I can optionally designate S50 will not start running until S49 is completed, this is useful sometimes.
- simoncion 11y agoJust use a sysvrc replacement (such as OpenRC ;) ) that actually supports service dependency declaration.
- aidenn0 11y agoActually I bootstrapped all of my init systems with OpenRC; it has tools for dependency calculation and all runscript based init scripts can be run with -D so that you can handle dependencies rather than it; I gradually replaced the existing init scripts with something a bit more amenable to the non-reparenting style I prefer, but it's very useful for getting started.
- ausjke 11y agoThanks. never used openrc and am looking into it.