Sunday, February 27 2011 @ 00:00 +0100
My ISP replaced a Thomson modem with a Cisco EPC3925 modem-router to fix the speed issue I was having. The good news is that the connection operates near its advertised bandwidth, the bad news is that tcp connections started to hang. It didn't take long to find out that this particular router drops "unused" tcp connections after five minutes.
The fix recommended in the linked topic (namely sysctl'ing
net.ipv4.tcp_keepalive_time & co) was mostly effective but I had to
lower the keepalive to one minute to keep my ssh sessions alive. The
trouble was that OfflineIMAP connections to the U.S. west coast still
hanged intermittently while it could work with Gmail just fine.
In the end, OfflineIMAP had to be patched to use the keepalive and the keepalive be lowered to 15s:
sysctl -w net.ipv4.tcp_keepalive_time=15 \ net.ipv4.tcp_keepalive_intvl=15 \ net.ipv4.tcp_keepalive_probes=20
Oh, and always include
socktimeout in the offlineimap config, that's
more important than keepalive unless you never have network issues.