in reply to Re^3: Proc::PID::File problem generating pid files, or: does it matter where a pid file lives?
in thread Proc::PID::File problem generating pid files, or: does it matter where a pid file lives?
Are you aware that this still has a race condition? You run a lot of tests in step 1, most of those tests involve system calls. Step 2 has two system calls. Each and every system call may cause a task switch to a malicious program that -- with a little bit of luck and good timing -- can change what you checked for in step 1, causing the following steps to fail rather unexpectedly. And each and every system call may cause a task switch to a second instance fighting for the PID file.Alexander:
Many of the options (like the daemontools that you note), do the same things that I describe (just masking them from the programmer).
While you are correct that manysome daemons do not need certain functions, that does not mean that they do not have their place. Add to that the fact that packages such as daemontools have their own built in set of limitations:
System requirementsand that they require an extra installation step to accomplish the same goal, and you can see that it is useful to know what is being done and why.
daemontools works only under UNIX.
In my opinion, when you have to adjust to another's decisions (and add complexity at the same time), it is not necessarily a good thing.
|
---|