Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError on del.diskr2l[ruid] in cachemessagelist #445

Closed
tmmorin opened this issue Mar 22, 2017 · 5 comments
Closed

KeyError on del.diskr2l[ruid] in cachemessagelist #445

tmmorin opened this issue Mar 22, 2017 · 5 comments
Labels

Comments

@tmmorin
Copy link

tmmorin commented Mar 22, 2017

General informations

  • system/distribution (with version): Debian unstable
  • offlineimap version (offlineimap -V): offlineimap v7.0.14, imaplib2 v2.55 (system), Python v2.7.13
  • Python version: 2.7.13
  • server name or domain: (internal)
  • CLI options: offlineimap -a Exchange

Configuration file offlineimaprc

[general]
accounts = Exchange
pythonfile = ~/.offlineimap/myfunctions.py
maxsyncaccounts = 2
ssl=no

[Account Exchange]
localrepository = Local
remoterepository = Remote
autorefresh = 1
status_backend = sqlite

[Repository Local]
type = IMAP
remotehost = localhost
remoteuser = redacted
remotepasseval = get_password("localhost","redacted")
singlethreadperfolder = yes
maxconnections = 12
holdconnectionopen = yes
ssl = False

[Repository Remote]
type = IMAP
remotehost = redacted
remoteuser = redacted
remotepasseval = get_password("redacted","redacted")
singlethreadperfolder = yes
maxconnections = 8
folderfilter = lambda folder: folder == "INBOX" or folder == "unsync" or folder.startswith('unsync/') or ("ments envoy" in folder)
nametrans: lambda folder: (((folder == "INBOX") or ("ments envoy" in folder) )and folder) or re.sub(r'^', r'INBOX.', folder) 
holdconnectionopen = yes
ssl = False

Logs, error

2017-03-22 09:30:50 Folder INBOX [acc: Exchange]:
2017-03-22 09:30:50  ERROR: ERROR in syncfolder for Exchange folder INBOX: Traceback (most recent call last):
2017-03-22 09:30:50   File "/usr/local/lib/python2.7/dist-packages/offlineimap/accounts.py", line 604, in syncfolder
2017-03-22 09:30:50     localfolder.cachemessagelist()
2017-03-22 09:30:50   File "/usr/local/lib/python2.7/dist-packages/offlineimap/folder/UIDMaps.py", line 145, in cachemessagelist
2017-03-22 09:30:50     del self.diskr2l[ruid]
2017-03-22 09:30:50 KeyError: 3243210
2017-03-22 09:30:50 
2017-03-22 09:30:50   3243210

Steps to reproduce the error

  • probably started to happen when I moved a lot of emails (hundreds) from INBOX on Local, to another folder on Local
  • when the error started I was running offlineimap 7.0.12 (debian package)
  • same error now repeats at each run, with the same ruid (3243210), whether I run 7.0.12 or 7.0.14
  • I also tried with/without singlethreadperfolder = yes but it makes no difference

Since I can't sync anything in INBOX anymore, a workaround would be much appreciated !

nicolas33 added a commit to nicolas33/offlineimap that referenced this issue Mar 22, 2017
This would require more digging to understand how this is possible. I suspect
that a previous run has been interrupted.

Github-ref: OfflineIMAP#445
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
@nicolas33 nicolas33 added the bug label Mar 22, 2017
@nicolas33
Copy link
Member

Please, try the above version. The urgent patch I wrote will ignore the error and continue the work.

I'm surprised we hit this error. I wonder the UIDMaps file could be broken in some way. I'd say this might happen after a previous interrupted run (not necessarily the one before).

This would still need more digging to get what's happening exactly and check if we can be better at handling this error.

@tmmorin
Copy link
Author

tmmorin commented Mar 22, 2017

Thanks for the very quick fix. I was shy to do such a blunt workaround myself, unsure what the side effect on internal consistency could be.

Let me know if I can help understanding the root issue.

@nicolas33
Copy link
Member

unsure what the side effect on internal consistency could be.

Actually, I didn't even tried to guess the side effects: the code fails at deleting a key that is missing. Either it was already removed (not likely) or it is missing from the collection since the beginning (more likely). So, ignoring this error shouldn't hurt. The UIDMaps file will be rewritten with the new data during the next run.

It's not clear to me from the above comment: did the patch help/fix your issue?> unsure what the side effect on internal consistency could be.

Actually, I didn't even tried to guess the side effects: the code fails at deleting a key that is missing. Either it was already removed (not likely) or it is missing from the collection since the beginning (more likely). So, ignoring this error shouldn't hurt. The UIDMaps file will be rewritten with the new data during the next run.

It's not clear to me from the above comment: did the patch help/fix your issue?

@tmmorin
Copy link
Author

tmmorin commented Mar 22, 2017 via email

@nicolas33
Copy link
Member

Ok, thank you.

nicolas33 added a commit that referenced this issue Mar 22, 2017
This would require more digging to understand how this is possible. I suspect
that a previous run has been interrupted.

Github-ref: #445
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants