Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > how best to handle httplib timeouts ?

Reply
Thread Tools

how best to handle httplib timeouts ?

 
 
Rich
Guest
Posts: n/a
 
      07-30-2003
Hi all,

I'm trying to write an app to monitor an IIS server, by connecting and
getting a page via httplib. the problem seems to be when IIS (or ASP) dies
httplib does not always return and sometimes I'm left with an app that
hangs. what is the best way to handle this ?

thanks,
rich.

the code looks like this:

try:
res = h.getresponse()
dat = res.read()
sFlag = sFlag + 1
except:
if debug > 0:
WriteLog(' Error receiving a response from 2nd mailbox page
request')
h.close()
return sFlag



 
Reply With Quote
 
 
 
 
Skip Montanaro
Guest
Posts: n/a
 
      07-30-2003

rich> I'm trying to write an app to monitor an IIS server, .... what is
rich> the best way to handle this ?

Off-topic response perhaps, but if you want to monitor services running on
remote machines, you should see what's already available. I use Nagios,
<http://www.nagios.org/>, and find it excellent for the purpose (a bit
complex to get started with, but very robust).

Skip

 
Reply With Quote
 
 
 
 
Rich
Guest
Posts: n/a
 
      07-30-2003

"Skip Montanaro" <> wrote in message
news:mailman.1059571376.25384.python-...
>
> Off-topic response perhaps, but if you want to monitor services running on
> remote machines, you should see what's already available. I use Nagios,
> <http://www.nagios.org/>, and find it excellent for the purpose (a bit
> complex to get started with, but very robust).
>
> Skip
>

Thanks Skip,
Monitoring services themselves is a snap but I'm trying to monitor the state
of IIS, and in particular the state of OWA running on IIS. OWA for Exchange
5.5 is a bit flakey at best and it doesn't always show up as a service
outage. The script I have so far connects to the server (using HTTPS) then
passes a login request for a mailbox and retrieves the Inbox page. It does 5
different requests in all and sometimes gets stuck on the third or fourth
request. Running the source code version seems a little better than the one
compiled with py2exe, and it will often return after what seems like a 2
minute socket timeout. I've also tried playing with different settings for
the default socket timeout value but that doesn't seem to help either. (I'm
running 2.3b2)

thanks,

rich.


 
Reply With Quote
 
Rich
Guest
Posts: n/a
 
      07-31-2003

"John J. Lee" <> wrote in message
news:...
>

[snip]
>
> 1. Get 2.3final (I don't know whether there was a bug fix, but I have
> a vague recollection there was some sort of problem with timeouts
> -- see the python-dev summaries and/or SF bug archive).


yes, this seems to have made the problem go away... I tried setting the
default timeout but it still acted flakey and would not connect, so, I
removed this and everything seems to be working, or at lest timing out
correctly.

2.3final also solved the "ImportError: No module named warnings" problem
with py2exe and I think this may have had something to do with it.

thanks,
rich.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Extending and altering httplib to handle bad servers Michael Ekstrand Python 0 08-08-2005 02:54 PM
forms authentication timeouts and session timeouts =?Utf-8?B?SmFzb24=?= ASP .Net 0 06-22-2004 09:24 AM
Handle multiple cookies with httplib Shagshag Python 0 04-01-2004 11:46 AM
Session-Timeouts and Idle-Timeouts on AS5300 and AS5800 Matt Cisco 1 02-17-2004 06:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57