[Imaplib2-devel] Gmail: downloading the rest of the mails
piers at janeelix.com
Mon Oct 10 12:11:32 BST 2011
On Mon, 10 Oct 2011 17:52:41 +0700, Jean Jordaan wrote:
> > 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.
> This would be my hypothesis. Certainly they need to take a defensive
> stance. But it would be nice if they were clear and explicit about it.
> I suppose if imaplib2 wanted to deal with this, it would have to use
> guesswork to figure out that this is probably not a real EOF, and to
> retry after an adequate delay.
You could try tinkering with the code around the "read 0" message. Try
making the loopcount longer, and see if that avoids the problem. At
the moment it tries 5 times, with a 0.1 sec sleep after each read 0,
which is 1/2 second. I guess its interesting that the read doesn't
raise an exception for broken socket, so it might be worthwhile hanging
Is this by any chance an SSL socket? If so it maybe the SSL code that
isn't handling the socket disconnection properly, though that does
Anyway, I still think a "read 0" should mean EOF, so that restarting a new
connection is the correct response.
More information about the OfflineIMAP-project