Forking in a CGI script can be problematic, because typically when the parent process ends, the OS will hold it in limbo and not let it entirely exit, until the child exits. However, the web server typically will not send anything to the client until the process it launched (the parent process) exits. I believe there are ways to work around this (by getting the two processes detached from one another, or by somehow telling the web server to go ahead and send what's been output so far) but I've never done it successfully. Generally there is another way to solve the problem, such as by using some kind of inter-process communication (e.g., sockets or signals) to have the CGI script request some action of an always-running server process (and send the client a "view results" link), or sending Javascript to the client that makes asynchronous requests back to the server.
In reply to Re: Forking via CGI
by jonadab
in thread Forking via CGI
by rsiedl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |