in reply to CGI and Background Processes
In my experience (at least with Apache) you need to close STDERR in addition to STDOUT, because Apache (or mod_cgi to be more precise) sets up two pipes to the CGI program (STDERR is connected to Apache's error log), which get duplicated when the CGI process forks... If you don't close them before starting the long-running process, Apache will wait for those handles to be closed by that forked process before it finishes the request cycle.
Preferably start the long-running process via fork/exec, in which case you can conveniently close STDOUT/STDERR after the fork (so the handles remain functional in the main CGI), but before doing the exec.
(A similar question came up recently, btw.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI and Background Processes
by mrguy123 (Hermit) on May 05, 2008 at 14:43 UTC | |
by almut (Canon) on May 05, 2008 at 15:04 UTC | |
by mrguy123 (Hermit) on May 05, 2008 at 15:34 UTC | |
by almut (Canon) on May 05, 2008 at 15:51 UTC | |
by mrguy123 (Hermit) on May 05, 2008 at 16:05 UTC |