Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Perl runs away....

by Anonymous Monk
on Mar 18, 2002 at 19:06 UTC ( #152561=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Running Apache with Activestate perl on a WIN32 system as a CGI processor. Problem I am having is that if an impatient user hits a submit button multiple times, I notice that the script is spawned for each request. Now the problem I am having: some of these requests never die. Is there something I have done, or need to do, or can do, to limit the number of processes that can be spawned? I know that this may be more of an apache question, but figured the perl monks may have some suggestions. If you want the script, please let me know...

Replies are listed 'Best First'.
(Kozz) Re: Perl runs away....
by Kozz (Friar) on Mar 18, 2002 at 19:23 UTC
    If you need not wait for the script to return a value to the user, you could send the client a redirect-header and then fork()-ing the script into the background.
    You can also implement a JavaScript solution which only allows one submit action, as seen here or here.
Re: Perl runs away....
by derby (Abbot) on Mar 18, 2002 at 19:45 UTC

    Kozz gives you something to chew on but there are other things you can consider.

    • Why is your user impatient?
    • Does it matter if your user is impatient?

    Your user may be impatient if your cgi is taking a long time to return any data. Are you buffering all the output and sending it at once? Or are you doing a lot of processing before you spit out any html? You may want try and send out html early (and often), so the user has some clue things are going on (Kozz hit this with his fork idea and merlyn goes into more detail in one of his columns).

    If it doesn't matter if the user hits the submit button many times, you may want to follow the "stop" techniques as outlined in Re: Detect Stop Button. This should ensure your cgi's die when no-one is listening anymore.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://152561]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2018-05-24 16:52 GMT
Find Nodes?
    Voting Booth?