[Twisted-Python] _twistd_unix.py / daemonize() / OSX / USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER
Maarten ter Huurne
maarten at treewalker.org
Thu Oct 14 12:31:39 EDT 2010
On Wednesday 13 October 2010, Glyph Lefkowitz wrote:
> To the extent that this is an intentional decision (it's at least half
> accidents of implementation) it's an attempt to allow twistd to actually
> display an error on the console if there is a serious error starting up,
> i.e. your plugin is not syntactically valid Python and it's just going
> to exit.
> While I remember agreeing that it's unfortunate, I can't actually recall
> any issues with executing the script before forking. Do we have tickets
> for them? Can you describe a couple?
A long time ago I did run into trouble with the uid/gid being applied by
twistd after the script is executed: log files would be owned by root
instead of by the specified uid/gid.
This is not what you asked, but I guess it's also a consequence of the
"execute the script first" behavior of twistd.
> If we are going to change this behavior, we should make twistd do
> something more correct, and optionally allow it to report startup errors
> to the console after it's forked, even if those errors don't necessarily
> crash it during startup. This isn't rocket science, inheriting file
> descriptors and delaying exit are all pretty easy.
When using twistd from a typical Linux init script, forking first would lead
to the script reporting the startup was a success and after that the error
message would be printed.
More information about the Twisted-Python