hanging connections

Sebastian Spaeth Sebastian at SSpaeth.de
Tue Mar 1 07:49:34 GMT 2011

On Fri, 25 Feb 2011 22:23:07 +0100, mega at retes.hu wrote:
> In the end it seems to be cured by:
> +        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)

Hi there. I am glad you fixed the hangs for you. I am missing a bit of
context for this patch though. Why do you believe can this patch fix the
hangs? Do you believe that gmail might close ssl connections when we
don't send keep-alive messages and our thread pool gets confused,
believing they are open and waiting for data when they have been closed

Why would they, do we keep idle ssl connections around that are being
shut down?

If something like this is the case, then I believe we should improve on
2 fronts: a) send keep-alive messages and b) make us detect dead
connections better and c) change our timeout strategies so we don't get
them closed on us in the first place.

I am not a networking specialist. man 7 socket says:
              Enable sending of  keep-alive  messages  on  connection-oriented
              sockets.  Expects an integer boolean flag.

This sounds like a good thing to me, which wouldn't harm in any case. So
I am all for this patch and will send a properly formatted patch as a
reply to this one, containing a Signed-off-by from you, which is
hopefully ok for you.

Nicolas, this patch can't hurt and might fix gmail hangs. Is it a
candidate for the stable (and next) branch? We should still not deadlock
if ssl closes connections on us without raising Exceptions though, so
this requires further thought.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110301/e85bdf9d/attachment.sig>

More information about the OfflineIMAP-project mailing list