I am running mod_wsgi and Django on apache2 httpd 2.2.12. I do quite a few os.system() and subprocess.Popen() calls, and was wondering: is there any option/directive to configure apache2 so that the prefork child processes close all file descriptors except what is used to communicate with the main prefork process?
If I receive a request to start a process, and then apache restarts, it has been observed that some of those apache-initiated processes inherit the apache descriptors (i.e. port 80), causing apache to have trouble binding on a restart. I am looking for a way to close all descriptors that aren't being used.
Perhaps the ability to have the port 80 descriptor open in a child is a feature to allow anyone to take over if the main process crashes?