[Imaplib2-devel] Gmail: downloading the rest of the mails

Piers Lauder piers at janeelix.com
Fri Oct 7 23:50:16 BST 2011

On Fri, 07 Oct 2011 17:38:33 +0200, Sebastian Spaeth wrote:
  > On Mon, 03 Oct 2011 10:59:31 -0400, Dave Abrahams <dave at boostpro.com> wrote:
  > > > After every 100 messages, OfflineIMAP gets stuck with:
  > > >
  > > > DEBUG[imap]:   31:24.19 imap.gmail.com reader socket error: <type
  > > > 'exceptions.IOError'> - Too many read 0
  > > > DEBUG[imap]:   31:24.19 imap.gmail.com reader finished
  > > > DEBUG[imap]:   31:24.19 imap.gmail.com handler terminating: "socket
  > > > error: <type 'exceptions.IOError'> - Too many read 0"
  > > 
  > > I've seen a lot of those "too many read" messages from my Gmail account
  > > with offlineimap in the past few weeks.
  > It has unfortunately been reported a lot since months. And it *only*
  > ever occurs with Gmail servers. I am not using Gmail, and I have never
  > managed to debug this. Help with this is much appreciated. It is
  > something down in the bowels of imaplib2.
  > Piers, the maintainer of imaplib2 has indicated it might be something
  > with locking. But it might also be some mysterious connection closing on
  > the gmail side.

In this case, where one gets an actual IOerror, it probably means that the
socket has become disconnected, as a read call returning 0 bytes usually
means EOF. No idea why the EOF is occuring, but the recommended imaplib2
solution would be to drop the current IMAP4 instance, initiate another,
and then carry on.

If this really is exactly 100 (magic number) messages each time, I
would be tempted to assume this might be a gmail policy - that they are
intending their users reset their connections evry 100 messages. Weird,
but possible.

Piers Lauder

More information about the OfflineIMAP-project mailing list