commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew January <andrewjanu...@gmail.com>
Subject [daemon] Upstart integration (removing checkuser)
Date Tue, 13 Oct 2015 13:34:18 GMT
Hey,

I'm trying to get upstart to launch a a java program daemonized using jsvc.

Upstart (annoyingly) doesn't have any support for pid files, but instead
monitors system calls to detect forks. You can control whether it's
expecting 1 or 2 forks using the "expect fork" and "expect daemon"
respectively (http://upstart.ubuntu.com/cookbook/#expect)

If I don't pass the -user flag to jsvc, I can get upstart to detect the
controller process using "expect fork". However, if I _do_ pass the -user
flag (because the java program needs to read some root-owned files on
startup, then drop to a non-privileged user) it doesn't pick up the correct
process because jsvc has extra forks to check the user passed in is valid (
http://svn.apache.org/viewvc/commons/proper/daemon/branches/1.0.x/src/native/unix/native/jsvc-unix.c?view=markup&pathrev=1460687#l427).
You actually get two extra forks, because the process restarts with the
given procname.

Looking through the code, the only reason I can see for it to fork and
check the user is as a fail-early strategy and not create the controller
process if it's never going to be able to switch the user. I am thinking of
submitting a patch to add a "-disableusercheck" flag which would skip the
checkuser call. Is there another reason for the checkuser fork that means
removing it would lead to issues? If I submitted such a patch is it likely
to be considered?

Cheers,
Andrew

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message