eric at ericwalstad.com
Wed Jun 2 00:22:04 EDT 2004
Hi all, I'm attempting to spawn a process in my mod_python function. I want to run a long-running script in a seperate process while returning the process id to the client quickly. However, the spawned process goes zombie (defunct), I think when the mod_python function finishes sending the response to the client. Here's how I'm spawning the process: process_id = os.spawnl(os.P_NOWAIT, BUILDISO_COMMAND) and when I check the status of the spawned process: # ps ax [...] 4229 ? S 0:00 /usr/sbin/httpd 4237 ? Z 0:00 [httpd] <defunct> It is defunct. (The parent is dead, long live the parent!) Do any of you have advice for a good way to keep the user from having to wait for long processes to finish before seeing a response from mod_python? I'm running Fedora Core 2, mod_python-3.1.3-1, python 2.3.3, apache 2.0.49 I'm not sure if it matters, but my .htaccess file for this little app contains only: AddHandler python-program .py PythonHandler mod_python.publisher PythonDebug On As a bit of background, the spawned script is creating an iso file approx 45MB for the client to download (later). I have it working using: commands.getstatusoutput(BUILDISO_COMMAND) but that makes the user wait until the child process is complete. I just want to keep the user from having to stare at a an empty, spinning browser while the iso is built. Many thanks for your time, wisdom and suggestions. Best regards, Eric.