OfflineIMAP/offlineimap

offlineimap cannot acquire lock after system suspend

Open

#516 aberto em 14 de jan. de 2018

Ver no GitHub
 (3 comments) (2 reactions) (0 assignees)Python (373 forks)batch import
enhancementgood first issueneed contributor!

Métricas do repositório

Stars
 (1.765 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

  • system/distribution: Arch Linux

  • offlineimap version (offlineimap -V): offlineimap v7.1.4, imaplib2 v2.57 (bundled), Python v2.7.14, OpenSSL 1.1.0g 2 Nov 2017

  • Python version: Python 3.6.4

#### Configuration file offlineimaprc
[general]
accounts = aishpant

[Account aishpant]
localrepository = local-aishpant
remoterepository = remote-aishpant
maxage = 2017-12-25

[Repository local-aishpant]
type = Maildir
localfolders = /home/a/mail/aishpant

[Repository remote-aishpant]
type = Gmail
remoteuser = xxx@gmail.com
remotepass = xxxpass
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
folderfilter = lambda folder: folder in ['INBOX', 'LKML', 'attrDoc']

I am using systemd user timer to sync my emails.

#### offlineimap.service
[Unit]
Description=Offlineimap Service (oneshot)
Documentation=man:offlineimap(1)

[Service]
Type=oneshot
ExecStart=/usr/bin/offlineimap -o -u basic
# Give 120 seconds for offlineimap 
# to gracefully stop before hard killing it
TimeoutStopSec=120

[Install]
WantedBy=mail.target
#### offlineimap.timer
[Unit]
Description=Offlineimap Query Timer

[Timer]
OnBootSec=2m
OnUnitInactiveSec=5m

[Install]
WantedBy=default.target

Steps to reproduce the error

  • Close the lid during a sync
  • Open again, once in a while offlineimap fails to launch with the following error :
OfflineIMAP 7.1.4
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (bundled), Python v2.7.14, OpenSSL 1.1.0g  2 Nov 2017
Account sync aishpant:
 *** Processing account aishpant
 ERROR: Could not lock account aishpant. Is another instance using this account?
 *** Finished account 'aishpant' in 0:00
ERROR: Exceptions occurred during the run!
ERROR: Could not lock account aishpant. Is another instance using this account?

Traceback:
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 282, in syncrunner
    self.__lock()
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 246, in __lock
    exc_info()[2])
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 235, in __lock
    fcntl.lockf(self._lockfd, fcntl.LOCK_EX|fcntl.LOCK_NB)

I can delete the lock file under ~/.offlineimap/ and start it up again. But I was wondering if there was cleaner solution to this.

Guia do colaborador