Closed damey2011 closed 4 years ago
Just in case or anyone who encounters such issue also, the issue is that creating ioloop before forking is problematic on OSX, and it's a known issue here: https://groups.google.com/forum/#!topic/python-tornado/DkXjSNPCzsI.
The solution is to swap the lines server = get_server()
with the _daemonize()
, so we get to create the fork before initializing the server, which will end up in a code like:
def daemonize():
"""A wrapper around python-daemonize context manager."""
def _daemonize():
pid = os.fork()
....
....
_daemonize()
server = get_server()
server.serve_forever()
Running the server as a daemon as illustrated in the demo here: https://github.com/giampaolo/pyftpdlib/blob/master/demo/unix_daemon.py
This throws
OSError: [Errno 9] Bad file descriptor
.Platform: OSX