In my program, A serve-forever daemon is restarted in a subprocess.
The program itself is a web service, using port 5000 by default.
I don't know the detail of the start script of that daemon, but it seems to inherit the socket listening on port 5000.
So if I were to restart my program, I'll find that the port is already occupied by the daemon process.
Now I am considering to fine tune the subprocess function to close the inherited socket FD, but I don't know how to get the FD in the first place.