Red Hat Bugzilla – Bug 479135
offlineimap quits even if one of the mail servers isn't reachable
Last modified: 2009-01-13 17:46:30 EST
Description of problem:
I have set up offlineimap to fetch mail from two different imap accounts. One is over vpn. If the vpn isn't up, offlineimap just quits and doesn't continue fetching from the other account.
thanks for the report. Could you please post the trace offlineimap writes into your console (if you use blinkenlights or TTY interface)? I will try to bring up a patch then.
Well, a traceback will just state the obvious: that the socket failed to connect. This can be easily simulated by pointing one of the accounts to a fake url:port.
Anyhow, here's the trace if I don't have my VPN connection up.
Thread 'Account sync RH' terminated with exception:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/offlineimap/threadutil.py", line 149, in run
File "/usr/lib64/python2.5/threading.py", line 446, in run
File "/usr/lib/python2.5/site-packages/offlineimap/accounts.py", line 108, in syncrunner
File "/usr/lib/python2.5/site-packages/offlineimap/accounts.py", line 142, in sync
File "/usr/lib/python2.5/site-packages/offlineimap/repository/Base.py", line 135, in syncfoldersto
srcfolders = src.getfolders()
File "/usr/lib/python2.5/site-packages/offlineimap/repository/IMAP.py", line 194, in getfolders
imapobj = self.imapserver.acquireconnection()
File "/usr/lib/python2.5/site-packages/offlineimap/imapserver.py", line 224, in acquireconnection
File "/usr/lib64/python2.5/imaplib.py", line 1128, in __init__
IMAP4.__init__(self, host, port)
File "/usr/lib64/python2.5/imaplib.py", line 163, in __init__
File "/usr/lib/python2.5/site-packages/offlineimap/imapserver.py", line 65, in open
imaplibutil.new_open_ssl(self, host, port)
File "/usr/lib/python2.5/site-packages/offlineimap/imaplibutil.py", line 155, in new_open_ssl
gaierror: (-2, 'Name or service not known')
Last 1 debug messages logged for Account sync RH prior to exception:
maildir: MaildirRepository initialized, sep is '.'
Created attachment 328766 [details]
This patch should prevent the whole application from crashing with one single thread
I am going to discuss that (and the other issue) with upstream.
As a temporary fix you could try out the attached patch, as it should fir your usecase (but probably breaks the design decisions of the upstream author).
Forget about that patch it breaks a lot of functionality.
I asked upstream and it seems preventing that behavior would require a major source code revamp. That will probably not happen.
So the solution for your special case is the -a switch which allows you to handle single accounts for single invocations. Simply use that in your cron script, and you'll be fine.
(As a side note: that's what John Goerzen does too, so it's a pretty well known use case ;))
I'll close this bug as 'WONTFIX' although, if I happen to have _much_ spare time...