You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by "Sean Cavanaugh (scavanau)" <sc...@cisco.com> on 2012/03/02 16:21:36 UTC

[users@httpd] CGI-BIN Timeout Question w/ Python

Hello All,

 

I am trying to write a webpage wrapper for some scripts I have written
in python on my FreeBSD 9 machine.

 

When I do this on the command line

 

#python tests.py

 

It works fine, although the script takes 8 full seconds to
run...(normal) when I do a:

 

proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'],
stdout=subprocess.PIPE) 

 

in a cgi-bin .py webpage the script seems to time out.  There are no
errors in the log (/var/log/httpd-error.log).  When I make a 'fake'
shorter version of the script that only takes a fraction of a second to
run (versus the full 8 second version) the subprocess.Popen command
works fine and returns the data fine to the web browser.  Doing some
digging it looks like the cgi-bin timeout is default at 300 seconds
which I am nowhere near...  I am not sure where to go at this point... I
was thinking of running this in the background so the script can
continue on using (&) and then checking afterwards for a results file or
something... but that seems like a crappy fix.  Sorry to be so ambiguous
but I have no errors (just behavior) to work with and I think it's
probably an architecture problem with the way I am approaching this on
apache.  I am open to any and all suggestions but unfortunately I can
switch off FreeBSD 9.

 

 

============================

Sean Cavanaugh

Cisco Global Certifications Team - IPv6

 


Re: [users@httpd] CGI-BIN Timeout Question w/ Python

Posted by Tom Evans <te...@googlemail.com>.
On Fri, Mar 2, 2012 at 3:21 PM, Sean Cavanaugh (scavanau)
<sc...@cisco.com> wrote:
> Hello All,
>
>
>
> I am trying to write a webpage wrapper for some scripts I have written in
> python on my FreeBSD 9 machine.
>
>
>
> When I do this on the command line
>
>
>
> #python tests.py
>
>
>
> It works fine, although the script takes 8 full seconds to run…(normal) when
> I do a:
>
>
>
> proc = subprocess.Popen(['/usr/local/bin/python', 'tests.py'],
> stdout=subprocess.PIPE)

What do you do with proc after this? I imagine that your proc
finishes, but hangs because it is waiting for an unexited child.

>
>
>
> in a cgi-bin .py webpage the script seems to time out.  There are no errors
> in the log (/var/log/httpd-error.log).  When I make a ‘fake’ shorter version
> of the script that only takes a fraction of a second to run (versus the full
> 8 second version) the subprocess.Popen command works fine and returns the
> data fine to the web browser.  Doing some digging it looks like the cgi-bin
> timeout is default at 300 seconds which I am nowhere near…  I am not sure
> where to go at this point… I was thinking of running this in the background
> so the script can continue on using (&) and then checking afterwards for a
> results file or something… but that seems like a crappy fix.  Sorry to be so
> ambiguous but I have no errors (just behavior) to work with and I think it’s
> probably an architecture problem with the way I am approaching this on
> apache.  I am open to any and all suggestions but unfortunately I can switch
> off FreeBSD 9.
>

FreeBSD is a boon, not a burden :)

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org