OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

Zero byte message synced #584

Open varac opened 5 years ago

varac commented 5 years ago

General informations

Configuration file offlineimaprc

[general]
accounts   = me.my.domain
fsync      = false

########   me@my.domain

[Account me.my.domain]
localrepository  = me@my.domain_local
remoterepository = me@my.domain_remote

[Repository me@my.domain_local]
type = Maildir
localfolders = ~/.offlineimap/Mail/me@my.domain
sep = /

[Repository me@my.domain_remote]
type = IMAP
remotehost = mail.my.domain
remoteuser = me
remoteport = 993
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotepasseval = "..."

Logs, error

OfflineIMAP 7.2.1
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
INFO:OfflineImap:OfflineIMAP 7.2.1
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (system), Python v2.7.15+, OpenSSL 1.1.1  11 Sep 2018
INFO:OfflineImap:imaplib2 v2.57 (system), Python v2.7.15+, OpenSSL 1.1.1  11 Sep 2018
Account sync me.my.domain:
 *** Processing account me.my.domain
INFO:OfflineImap:*** Processing account me.my.domain
 Establishing connection to mail.my.domain:993 (me@my.domain_remote)
INFO:OfflineImap:Establishing connection to mail.my.domain:993 (me@my.domain_remote)
Folder Drafts [acc: me.my.domain]:
 Syncing Drafts: IMAP -> Maildir
INFO:OfflineImap:Syncing Drafts: IMAP -> Maildir
Folder Archives [acc: me.my.domain]:
 Syncing Archives: IMAP -> Maildir
INFO:OfflineImap:Syncing Archives: IMAP -> Maildir
Folder INBOX [acc: me.my.domain]:
 Syncing INBOX: IMAP -> Maildir
INFO:OfflineImap:Syncing INBOX: IMAP -> Maildir
Folder Junk [acc: me.my.domain]:
 Syncing Junk: IMAP -> Maildir
INFO:OfflineImap:Syncing Junk: IMAP -> Maildir
Folder lists [acc: me.my.domain]:
 Syncing lists: IMAP -> Maildir
INFO:OfflineImap:Syncing lists: IMAP -> Maildir
Folder Sent [acc: me.my.domain]:
 Syncing Sent: IMAP -> Maildir
INFO:OfflineImap:Syncing Sent: IMAP -> Maildir
Folder spam [acc: me.my.domain]:
 Syncing spam: IMAP -> Maildir
INFO:OfflineImap:Syncing spam: IMAP -> Maildir
Folder Spam [acc: me.my.domain]:
 Syncing Spam: IMAP -> Maildir
INFO:OfflineImap:Syncing Spam: IMAP -> Maildir
Folder Trash [acc: me.my.domain]:
 Syncing Trash: IMAP -> Maildir
INFO:OfflineImap:Syncing Trash: IMAP -> Maildir
Account sync me.my.domain:
 *** Finished account 'me.my.domain' in 0:04
INFO:OfflineImap:*** Finished account 'me.my.domain' in 0:04

Steps to reproduce the error

I can't reproduce this. This happens very seldom and randomly. Looking at the syslog today I noticed that during the offlineimap run my firewall reconfigured, so this might be related.

216 also reports zero byte messages.

varac commented 5 years ago

These are the zero byte messages produced:

$ find ~/.offlineimap/Mail/ -type f -size 0b -exec ls -la {} \;
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788366_1.2456.mybox,U=10265,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788367_0.2456.mybox,U=10266,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788367_1.2456.mybox,U=10267,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788366_0.2456.mybox,U=10264,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788367_2.2456.mybox,U=10268,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788367_3.2456.mybox,U=10269,FMD5=e6dbca21d4865b265ca2780205b19305:2,S
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788367_4.2456.mybox,U=10270,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/lists/cur/1542788367_5.2456.mybox,U=10271,FMD5=e6dbca21d4865b265ca2780205b19305:2,
-rw-r--r-- 1 varac varac 0 Nov 21 09:19 /home/varac/.offlineimap/Mail/me@my.domain/INBOX/cur/1542788365_0.2456.mybox,U=12435,FMD5=7e33429f656f1e6e9d79b29c3f82c57e:2,S
-rw-r----- 1 varac varac 0 Nov 21 10:38 /home/varac/.offlineimap/Mail/.notmuch/xapian/flintlock
varac commented 5 years ago

Besides fixing the underlying problem in offlineimap I'd be interested how to manual recover from this situation (as in: re-fetch the messages in question with their content from the server). Using an different imap client I can read the messages, so they are not empty on the server.

nicolas33 commented 5 years ago

That's weird. It looks like we'd need to add sanity checks in this area.

Besides fixing the underlying problem in offlineimap I'd be interested how to manual recover from this situation (as in: re-fetch the messages in question with their content from the server).

The only way to re-download the offending messages only is to manually remove the lines for these UIDs in the cache and the messages in the maildir. Make sure to not run offlineimap while both the maildir and the cache are not consistent.