Re: Apache timeout on external command



On 15 May, 02:11, Ian Petts <ipe...@xxxxxxxxx> wrote:
We have a Solaris 9 server running apache 2.0.53.

I have written a custom Perl cgi script to act as a front-end for a
command-line application on a remote server. The Perl script connects
via ssh to the remote box, runs a command, parses the output and
presents a table to the user with various information about the host.

The host in question is under heavy load and can take anywhere from 20
seconds to about two minutes to complete the command. Every time I run
the command manually from the command line (ssh user@host 'command with
arguments') it eventually returns the expected data, but when running as
part of the cgi script it appears that apache often gives up waiting for
the script to complete and simply stops sending any data back to the
client. The remainder of the Perl script (following the ssh call) does
not get run, but doing a process search on the remote host I can see the
remote command still running to completion after apache has apparently
given up. It seems that if the remote command finishes within 20-30
seconds then the script completes just fine, but if it takes any longer
apache closes the connection to the client browser without letting the
script finish.

I have checked the error log debug entries and can see no difference
between a successful run of the script verses an unsuccessful run, apart
from the length of time reported.

I know the version of apache we are running is quite old, but upgrading
it is not a priority at this time especially since it is an internal
admin server and not publicly accessible.

Can someone please point me at the correct configuration option or other
info to correct this?

Thanks,
Ian.

Have you got a rlimitCPU configured? Are you sure that Apache is
dropping the connection? How long should the browser wait? Are the
requests being made via HTTP/1.1 or 1.0?

Long running jobs are a frequently discussed topic on the web dev
boards - the consensus is that the best solution is to dissociate the
long-running process from the initiating HTTP request. and have it
report-back to datum, then, for example, monitor the datum using ajax.

(hint: a simple way to dissociate a process is `at now myprog`)

C.
.



Relevant Pages

  • Apache timeout on external command
    ... We have a Solaris 9 server running apache 2.0.53. ... command-line application on a remote server. ... The Perl script connects ... seconds to about two minutes to complete the command. ...
    (comp.infosystems.www.servers.unix)
  • Re: wshremote not running script on remote computer
    ... "The script you deploy to the remote computer must not attempt to interact ... I do want to open a command window on a remote machine, ...
    (microsoft.public.scripting.vbscript)
  • Re: Piping and scripts with scp
    ... generate one key pair for every command you want to run and name the key ... if you invoke scp with the corresponding key, scp's remote invocation is ... The script will need to execute via cron and run ...
    (FreeBSD-Security)
  • Re: Perl scripts run in command line, but not in browser
    ... running the newest apache and all that. ... I have a script that uses the perl module html::template ... I assume that because it runs properly in the command ...
    (comp.infosystems.www.servers.unix)
  • Re: wshremote not running script on remote computer
    ... I do want to open a command window on a remote machine, ... This is why I want to create this script, so that administrators can run it ...
    (microsoft.public.scripting.vbscript)