Open nickodell opened 4 years ago
I don't consider this a bug. If foreground, the file descriptors wouldn't be closed, otherwise they are and socket (SocketIO) uses file descriptors which are kept in a reference list in stdlib socket. If you close them by daemonization, stdlib does not know that descriptors it opened are closed. You could get the fd from socket and pass it to the daemonize call to keep it alive.
I'm running into a really specific and weird bug on OSX.
Reproduction instructions
Use OSX. I am using 10.15.4 right now; I don't know if the specific version matters.
Install daemonize 2.5.0.
Run this script:
Symptoms of bug
Before forking, the Python program can successfully do a DNS lookup.
The following message appears in Console.app under Log Reports > system.log:
Variations tried
I have run the reproduction script on Linux, and it can successfully resolve DNS before and after forking. (This is why I marked this as an OSX-specific bug.)
I have run the reproduction script without the first DNS lookup. This works.
I have run the reproduction script with
foreground=True
. This works.I've tried putting a sleep between the two DNS lookups. This doesn't help.
Workaround
Don't do DNS lookups before forking.