Python - CGI-BIN - Apache Timeout Problem

Sean Cavanaugh (scavanau) scavanau at cisco.com
Fri Mar 2 15:09:16 EST 2012


Hello List,

 

Would appreciate some insight/help, ran out of ideas...

 

BRIEF OVERVIEW:

 

I am trying to create a simple webserver gui wrapper for a set of
scripts I developed to test some of our firewalls here at Cisco.  Being
that the total amount of engineer that will ever probably use this is 4
people and my limited python experience I just decided to do a quick
cgi-bin solution.  I control the machine with the webserver on em0 where
I do my fw testing on em1/em2.

 

Browser goes to http://webserver/main.py    -> main.py executes a
script->tests.py ->test.py imports my engine v6tester_main.py which is a
series of functions I wrote. tests.py kicks of whatever test main.py
wanted.  

 

THE PROBLEM:

 

When I execute the scripts from the command line (#python main.py) it
generates it fine (albeit slowly), it prints all the html code out
including the script.  The 'core' part of the script dumbed down to the
lowest level is->

 

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

        output = proc.stdout.read()

        print output

        proc.stdout.close()

 

When I open main.py and execute the script it just hangs... it seems to
execute the script (I see pcap fires on the interface that I am testing
on the firewall) but its not executing correctly... or loading the
entire webpage...the webpage keeps chugging along and eventually gives
me an error timeout.

 

I know it's not a permissions issue or setup issue b/c I did a proof of
concept where I just fired one simple pcap and it works fine (reported
back just like it would if I ran it on the command line).. it has
something to do with either the amount of prints out the script is
doing, or the timing.  I see no problems except the timeout (nothing in
logs: /var/log/http-error.log).  My script takes about 8 secounds to
run.  It does use threading but I wouldn't think that would mess it up.

 

BTW: I posted here if this helps anyone:
http://stackoverflow.com/questions/9524758/cgi-bin-timing-timeout-on-fre
ebsd-apache22

 

 

Thanks in advance for any ideas.  I can include the whole main.py if
that would help.

 

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

Sean Cavanaugh

Cisco Systems

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120302/b89b39a1/attachment.html>


More information about the Python-list mailing list