[Twisted-Python] Missing feature in detecting stalled PB connections?

Luc Stepniewski luc.stepniewski at adelux.fr
Tue Mar 7 06:11:40 EST 2006


I tried to implement that timeout method. I think I did it corrrectly (example 
attached in this mail), but it seems that one can't disconnect() a PB if it 
hasn't replied yet :-( It looks like it is locked and waits for an answer 
from the remote PB.
So if you run a netcat (nc -vv -l -p 9003) and run my code, timeoutHandler()
is called but the factory is NOT disconnected :-(

Did you do something different from my code?

Thanks for your help,

On Wednesday 22 February 2006 04:12, Uwe C. Schroeder wrote:
> On Tuesday 21 February 2006 09:58, Itamar Shtull-Trauring wrote:
> > On Tue, 2006-02-21 at 18:40 +0100, Luc Stepniewski wrote:
> > > On Tuesday 21 February 2006 17:06, Itamar Shtull-Trauring wrote:
> > > > The typical way to do this is have some sort of remote_ping method
> > > > that returns immediately on the server (or on the client) that the
> > > > client (or the server) calls every once in a while, with a timeout
> > > > for the response. If that times out the problem is likely the
> > > > connection, not the server being slow, in which case you can close
> > > > the connection.
> > >
> > > Yes, it's the same thing as making a pseudo "timeout" with a callLater.
> >
> > Not exactly. What I'm suggesting is a different command that you send in
> > addition to your regular operations. This extra command, "ping", is
> > expected to return a result quickly; if it doesn't you know something is
> > wrong. That way even if your regular commands take a really long time
> > for the server to process you can still tell if the server itself (or
> > your connection to it) is ok. Every 10 seconds, say, you ping the
> > server; if you don't get a response back in 5 seconds it's probably
> > down.
> That's actually what I'm doing with my application - although for a
> different reason. I send a "ping" that immediate is answered by a "pong" -
> if I don't get the pong withing 30 seconds I shut the connection down.
> My reason is a missconfigured firewall at one of my clients which drops
> forwarding after about 90 seconds idle time. Since I couldn't get their
> (incompetent) network admin to fix it I send a ping every 30 sec, so the
> firewall thinks the connection is active and doesn't drop it.
> Luc: if you need the code for that (although it's very simple), drop me a
> line.

Luc Stepniewski <luc.stepniewski at adelux.fr> <sip:724766 at fwd.pulver.com>
Adelux - Securite, Linux  Public key: <http://lstep.free.fr/pubkey.txt>
Key BC0E3C2A fingerprint = A4FA466C68D27E46B427  07D083ED6340BC0E3C2A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug.py
Type: application/x-python
Size: 1737 bytes
Desc: not available
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20060307/394f0447/attachment.bin 

More information about the Twisted-Python mailing list