Hi,
Sorry if this has been covered before, but I couldn't find anything on the web even though I'm sure it's fairly common.
We've had an intermittent problem of processes not being killed on our server for one of our cgi scripts. I finally discovered today when this happens: it's if someone either double-clicks the link (most common), or closes their browser window before the cgi has completed.
I think this is because the script prints directly to STDOUT, ie the client browser window, and if this is no longer available to print to, then the process just sits and waits forever rather than dying.
I did not write this script! And I must admit I don't often write perl scripts. I would have written it differently but I don't have the time right now. Is there a way of forcing the process to die if STDOUT disappears? The cgi is called directly via a link, not through a form.
I'll show you the code if it will help, but it's pretty simple, here's a snippet:
In this case, the "fetch_cd2list_sql" subroutine takes a couple of seconds as it has to query our database and return a long list.
Any help much appreciated!
Chris
Sorry if this has been covered before, but I couldn't find anything on the web even though I'm sure it's fairly common.
We've had an intermittent problem of processes not being killed on our server for one of our cgi scripts. I finally discovered today when this happens: it's if someone either double-clicks the link (most common), or closes their browser window before the cgi has completed.
I think this is because the script prints directly to STDOUT, ie the client browser window, and if this is no longer available to print to, then the process just sits and waits forever rather than dying.
I did not write this script! And I must admit I don't often write perl scripts. I would have written it differently but I don't have the time right now. Is there a way of forcing the process to die if STDOUT disappears? The cgi is called directly via a link, not through a form.
I'll show you the code if it will help, but it's pretty simple, here's a snippet:
Code:
} elsif($cd1) {
print $query->header;
&textpageheader("Dali database: select structural neighbours of $cd1");
&fetch_cd2list_sql($cd1);
&textpagefooter;
}
In this case, the "fetch_cd2list_sql" subroutine takes a couple of seconds as it has to query our database and return a long list.
Any help much appreciated!
Chris