Avoid Apache Timeout Per Script

P

PerlGoon

I have a Perl script on my server that needs to execute without being
terminated by the default Apache timeout. For example when the script
is executed, it needs to hold its connection even if it doesn't return
a response to the client after 2 1/2 minutes (my current default
timeout).

Other than changing the Apache config settings, which I would like to
avoid for obvious security concerns, is there a way to modify the
timeout settings on a per script basis (i.e. executing some command in
the Perl script itself)??
 
J

John Bokma

PerlGoon said:
I have a Perl script on my server that needs to execute without being
terminated by the default Apache timeout. For example when the script
is executed, it needs to hold its connection even if it doesn't return
a response to the client after 2 1/2 minutes (my current default
timeout).

Other than changing the Apache config settings, which I would like to
avoid for obvious security concerns, is there a way to modify the
timeout settings on a per script basis (i.e. executing some command in
the Perl script itself)??

I am guessing, but I would say no. The script termination would be
(almost) pointless if there was such a command.

Maybe a solution is: have the page autorefresh itself (or use AJAX), and
let the program dump its state every 2 minutes. When kicked into action
again, it loads it state, and continues.
 
X

xhoster

PerlGoon said:
I have a Perl script on my server that needs to execute without being
terminated by the default Apache timeout. For example when the script
is executed, it needs to hold its connection even if it doesn't return
a response to the client after 2 1/2 minutes (my current default
timeout).

I just do $|=1; and then print a ".\n" every so often. That seems to keep
the browser and/or apache (I don't know which of them is driving my time
out) happy for quite a while.

Other than changing the Apache config settings, which I would like to
avoid for obvious security concerns,

The concerns aren't all that obvious to me.

Xho
 
P

PerlGoon

Thank you for all your quick responses.... I may be approaching a
solution to my original task the wrong way.

What I am trying to accomplish is similar to an instant messaging
program....

A computer requests a particular script... is this case we'll call it
Connect.pl. The script executes on the server and opens up a socket on
the server. The script then sits and waits for data to be pushed
through the open socket. When the script receives data through the
socket, it "prints" out that data to the computer that originally
executed the script. It then closes the socket and the script ends.

The problem I am having is that I don't know how long it will take for
data to get pushed through the open socket. It could be 1 min or 5
hours...

If it is longer then 2 1/2 minutes in my case, the server automatically
times out the original request and the connection is broken.

I need some way of having a script that can be executed through port 80
(http) and maintain a connection (without sending a response) for a
significant amount of time... say 5 hours. Clear as mud?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top