Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21147

Re: Python - CGI-BIN - Apache Timeout Problem

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'prints': 0.07; 'subject:Apache': 0.07; 'scripts': 0.09; 'problem:': 0.09; 'subject:Problem': 0.09; 'output': 0.10; 'chugging': 0.16; 'deadlock': 0.16; 'err': 0.16; 'fires': 0.16; 'proc': 0.16; 'timeout.': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'loading': 0.18; 'seems': 0.20; 'cheers,': 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'interface': 0.23; 'command': 0.24; 'fine': 0.24; 'suspect': 0.24; 'received:209.85.220': 0.25; 'cc:2**0': 0.26; 'code': 0.26; 'testing': 0.26; 'script': 0.28; 'message-id:@mail.gmail.com': 0.29; 'sean': 0.29; 'print': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'keeps': 0.30; 'chris': 0.30; 'error': 0.30; 'url:library': 0.31; 'fri,': 0.34; 'url:python': 0.35; 'executing': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'received:209.85': 0.38; 'open': 0.38; 'url:org': 0.39; 'received:209': 0.39; 'skip:s 40': 0.40; 'header:Received:6': 0.61; '8bit%:23': 0.62; 'friends:': 0.67; 'webpage': 0.67; '8bit%:100': 0.69; 'skip:\xc2 10': 0.74; '12:09': 0.84; 'advise,': 0.84; 'hanging': 0.84; 'sender:addr:chris': 0.84
Received-SPF pass (google.com: domain of chris@rebertia.com designates 10.52.91.82 as permitted sender) client-ip=10.52.91.82;
Authentication-Results mr.google.com; spf=pass (google.com: domain of chris@rebertia.com designates 10.52.91.82 as permitted sender) smtp.mail=chris@rebertia.com; dkim=pass header.i=chris@rebertia.com
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=knVJEjVZp+g0F+nLYmdhDY/bSRhyo9UG6qO0mUDXw0g=; b=cZd9+8io1cfg2Jr8e+NpNb9rSOYTNu6zrMc2VLXcQTbA22FSIqHPoW71HLc1s2gJ88 yb81BCnw5MqCwaXd/cGO62qxq1v6+GB8yglb7EWyxQNC2T7k6aoWqkYlfByeNGI3Urb0 GUV/KTrQIQwm9Y0OivSR3sj+4BwRM8cSVC6wM=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <6FC169072CBFF3409B6E74F50175A4650497A3F9@xmb-sjc-215.amer.cisco.com>
References <6FC169072CBFF3409B6E74F50175A4650497A3F9@xmb-sjc-215.amer.cisco.com>
Date Fri, 2 Mar 2012 12:22:41 -0800
X-Google-Sender-Auth TzF2zaA_yUr1dGU14JBpt66y3EU
Subject Re: Python - CGI-BIN - Apache Timeout Problem
From Chris Rebert <clp2@rebertia.com>
To "Sean Cavanaugh (scavanau)" <scavanau@cisco.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Gm-Message-State ALoCoQnMRnxDUObhrUltDlRWxyrtVraedR9KB4pVZwkQbB5f05uq+P8+htHR+9wBrQGuruRYm2jo
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.353.1330719764.3037.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1330719764 news.xs4all.nl 6954 [2001:888:2000:d::a6]:55217
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:21147

Show key headers only | View raw


On Fri, Mar 2, 2012 at 12:09 PM, Sean Cavanaugh (scavanau)
<scavanau@cisco.com> wrote:
<snip>
> 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()

Note the red warning box about possible deadlock with .stdout.read()
and friends:
http://docs.python.org/library/subprocess.html#popen-objects

>         print output
>         proc.stdout.close()

As the docs advise, try using .communicate()
[http://docs.python.org/library/subprocess.html#subprocess.Popen.communicate
] instead:
    proc = subprocess.Popen(…)
    out, err = proc.communicate()
    print out

> 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.

The hanging makes me suspect that the aforementioned deadlock is occurring.

Cheers,
Chris
--
http://chrisrebert.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python - CGI-BIN - Apache Timeout Problem Chris Rebert <clp2@rebertia.com> - 2012-03-02 12:22 -0800

csiph-web