Gábor Melis | 25 Feb 22:23
Picon

Re: hanging connections

> I'll try without autorefresh.

I did, but it didn't change a thing.

In the end it seems to be cured by:

diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py
index cf82996..e27243f 100644
--- a/offlineimap/imaplibutil.py
+++ b/offlineimap/imaplibutil.py
@@ -111,6 +111,8 @@ class WrappedIMAP4_SSL(IMAP4_SSL):
             # FIXME
             raise socket.error(last_error)

+        self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
+
         #connected to socket, now wrap it in SSL
         try:
             if self._cacertfile:
	Modified offlineimap/init.py

and

sysctl -w net.ipv4.tcp_keepalive_time=15 \
          net.ipv4.tcp_keepalive_intvl=15 \
          net.ipv4.tcp_keepalive_probes=20

15s is pretty extreme I think. It has been going working fine for
several hours now with the original config, with autorefresh, two
accounts, four threads each.

I was going to say that this tells me is that one probably needs a
timeout parameter only to realize that there is one named socktimeout.
Bah. I haven't tested it yet, maybe a sensible default value is in
order.

Anyway, setting the SO_KEEPALIVE should not hurt, right?

_______________________________________________
OfflineIMAP-project mailing list
OfflineIMAP-project <at> lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/offlineimap-project

OfflineIMAP homepage: http://software.complete.org/offlineimap


Gmane