[offlineimap] downloading junk messages raise socket error with "copy message list.remove(x): x not in list" (#198)

Stéphane Campinas notifications at github.com
Sat Oct 24 20:32:09 BST 2015


I am running the version 6.5.7. I got the same issue at first as OP, but then got this one, and now it seems to be going fine... (there is a lot of mail to retrieve though). Maybe this log will help you somehow.

```ini
[general]
accounts = gmail

[Account gmail]
localrepository = Local
remoterepository = Remote
status_backend = sqlite

[Repository Local]
type = Maildir
localfolders = ~/.mail/gmail

[Repository Remote]
type = Gmail
remoteuser = ***
remotepass = ***
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder not in ['[Gmail]/All Mail', '[Gmail]/Bin', '[Gmail]/Drafts', '[Gmail]/Spam', 'SentMail', 'Trash', 'AllMail', 'Queue', 'Drafts']
```

```log
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.09 Copy message from Remote:[Gmail]/Important [sync] EXAMINE ('[Gmail]/Important',)
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com reader socket error: <class 'socket.error'> - [Errno 104] Connection reset by peer
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com reader finished
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com handler terminating: "socket error: <class 'socket.error'> - [Errno 104] Connection reset by peer"
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com handler EXAMINE:MNPA92.ready.set
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com writer finished
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com handler state_change_free.set
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important state_change_pending.release
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 imap.gmail.com handler finished
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important state => LOGOUT
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important [sync] LOGOUT ()
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important state_change_pending.acquire
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important ["<class 'offlineimap.imaplib2.abort'>: connection closed"]
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important _close_threads
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important call shutdown
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important state_change_pending.release
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.13 Copy message from Remote:[Gmail]/Important connection closed
2015-10-24 20:16:50 DEBUG: [thread]: Register new thread 'Copy message from Remote:[Gmail]/Sent Mail' (account 'gmail')
2015-10-24 20:16:50 INFO: Copy message 26 (23 of 2426) Remote:[Gmail]/Sent Mail -> Local
2015-10-24 20:16:50 INFO: Establishing connection to imap.gmail.com:993
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.14 Copy message from Remote:[Gmail]/Sent Mail imaplib2 version 2.43
2015-10-24 20:16:50 DEBUG: [imap]:   16:50.14 Copy message from Remote:[Gmail]/Sent Mail imaplib2 debug level 5, buffer level 3
2015-10-24 20:16:50 WARNING: Thread 'Copy message from Remote:[Gmail]/Important' terminated with exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/offlineimap/threadutil.py", line 163, in run
    Thread.run(self)
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.py", line 291, in copymessageto
    super(GmailFolder, self).copymessageto(uid, dstfolder, statusfolder, register)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Base.py", line 770, in copymessageto
    message = self.getmessage(uid)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.py", line 77, in getmessage
    data = self._fetch_from_imap(imapobj, str(uid), 2)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/IMAP.py", line 684, in _fetch_from_imap
    imapobj.select(self.getfullname(), readonly = True)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplibutil.py", line 50, in select
    result = super(UsefulIMAPMixIn, self).select(mailbox, readonly)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplib2.py", line 1008, in select
    typ, dat = rqb.get_response('command: %s => %%s' % rqb.name)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplib2.py", line 188, in get_response
    raise typ(exc_fmt % str(val))
OfflineImapError: Server 'imap.gmail.com' closed connection, error on SELECT '[Gmail]/Important'. Server said: command: EXAMINE => socket error: <class 'socket.error'> - [Errno 104] Connection reset by peer


Last 15 debug messages logged for Copy message from Remote:[Gmail]/Important prior to exception:
thread: Register new thread 'Copy message from Remote:[Gmail]/Important' (account 'gmail')
imap:   16:50.09 Copy message from Remote:[Gmail]/Important [sync] EXAMINE ('[Gmail]/Important',)
imap:   16:50.09 Copy message from Remote:[Gmail]/Important state_change_pending.acquire
imap:   16:50.09 Copy message from Remote:[Gmail]/Important _request_push(MNPA92, EXAMINE, {}) = MNPA92
imap:   16:50.10 Copy message from Remote:[Gmail]/Important data=MNPA92 EXAMINE "[Gmail]/Important"
imap:   16:50.10 Copy message from Remote:[Gmail]/Important EXAMINE:MNPA92.ready.wait
imap:   16:50.13 Copy message from Remote:[Gmail]/Important state_change_pending.release
imap:   16:50.13 Copy message from Remote:[Gmail]/Important state => LOGOUT
imap:   16:50.13 Copy message from Remote:[Gmail]/Important [sync] LOGOUT ()
imap:   16:50.13 Copy message from Remote:[Gmail]/Important state_change_pending.acquire
imap:   16:50.13 Copy message from Remote:[Gmail]/Important ["<class 'offlineimap.imaplib2.abort'>: connection closed"]
imap:   16:50.13 Copy message from Remote:[Gmail]/Important _close_threads
imap:   16:50.13 Copy message from Remote:[Gmail]/Important call shutdown
imap:   16:50.13 Copy message from Remote:[Gmail]/Important state_change_pending.release
imap:   16:50.13 Copy message from Remote:[Gmail]/Important connection closed
```

---
Reply to this email directly or view it on GitHub:
https://github.com/OfflineIMAP/offlineimap/issues/198#issuecomment-150842737
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20151024/a511aa18/attachment-0003.html>


More information about the OfflineIMAP-project mailing list