Message10540

Author zyasoft
Recipients teeohhem, zyasoft
Date 2015-12-16.19:11:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450293063.79.0.986382331394.issue2440@psf.upfronthosting.co.za>
In-reply-to
Content
Besides some minor testing usage, Twisted uses `os.fork` for two purposes:

1. Daemonization support. For Java, we can do this a number of ways:

   a. Cassandra, as one example, simply closes stderr and stdout; see https://github.com/apache/cassandra/blob/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java#L560

            if (System.getProperty("cassandra-foreground") == null)
            {
                System.out.close();
                System.err.close();
            }

Note this doesn't actually daemonize anything; to do that, you need to use something like Debian's `start-stop-daemon` command, which is used by the DataStax init.d scripts.

    b. Various other good starting points exist for Linux. I found this blog post helpful: http://www.mikeperham.com/2014/09/22/dont-daemonize-your-daemons/, which then points at the systemd man pages. Now that major distros have standardized on it, systemd especially works well and systemd can manage the complexity of daemonization. In other words, no worries about its former competitor, upstart.

    c. Apache Commons, specifically http://commons.apache.org/proper/commons-daemon/index.html, using either jsvc for Unix-like systems or procrun for Windows to get the equivalent idea on that architecture. Tomcat uses this approach; see https://tomcat.apache.org/tomcat-8.0-doc/setup.html

2. Process building in `twisted.internet.process`. So this is really akin to what `subprocess` does, but looks like with more control. Perhaps it's something we can get at a Jython-specific equivalent using Java Native Runtime with https://github.com/jnr/jnr-process, so long as we are on Unix-like systems.

Most likely the resolution of this bug is docs on the Jython wiki re daemonization; and possibly enhanced support for process building as part of a Jython-specific reactor.
History
Date User Action Args
2015-12-16 19:11:03zyasoftsetmessageid: <1450293063.79.0.986382331394.issue2440@psf.upfronthosting.co.za>
2015-12-16 19:11:03zyasoftsetrecipients: + zyasoft, teeohhem
2015-12-16 19:11:03zyasoftlinkissue2440 messages
2015-12-16 19:11:02zyasoftcreate