Complete.Org: Mailing Lists: Archives: offlineimap: November 2002:
Re: Network retry
Home

Re: Network retry

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jared Rhine <jared@xxxxxxxxxxx>
Cc: offlineimap@xxxxxxxxxxxx
Subject: Re: Network retry
From: John Goerzen <jgoerzen@xxxxxxxxxxxx>
Date: Thu, 14 Nov 2002 15:15:06 -0600

You might find some information and insight on this in bug 9 at:

https://bugs.complete.org/Ticket/Display.html?id=9

Essentially, we can split this issue into two parts:

1. Network problems during a sync

2. Network problems between syncs

Considering #1:

This is going to be a pretty serious problem.  It will mean that commands
may not be executed (or can not be executed).  I have chosen to make
OfflineIMAP resiliant in the face of a crash, and to cause it to abort if
there is any sort of network problem.  In this way, we avoid potential data
loss that may arise out of a complex attempt to try to recover from a fatal
failure.

Right now, OfflineIMAP will just abort.  It would be possible to isolate the
failure to the synchronization of a particular account, and to terminate
that synchronization, and then restart it later.  That is somewhat complex
yet, but doable.

Considering #2:

This will also currently cause OfflineIMAP to die.  We could just detect
errors and shut down the connections.  At the next sync, OfflineIMAP will
try to re-establish them anyway.

If your problem is mostly #2, I would suggest using holdconnectionopen = no
in your ~/.offlineimaprc.  That way, for each scheduled sync, OfflineIMAP
will open new connections and then close them.

-- John

On Thu, Nov 14, 2002 at 12:19:32PM -0800, Jared Rhine wrote:
> 
> A feature thought...It'd be nice if my offlineimap configuration were
> a bit more robust in the face of network errors.  My machine at home
> has network access about 99.5 percent of the time, but the network
> does go down (SF Bay Area cable modem connectivity).  So offlineimap
> dies (tracebacks below).
> 
> There's two design options; offlineimap could catch more network
> errors and just ignore them.  But I already have to wrap offlineimap
> to log errors usefully, so I could also just extend that to do a
> restart when offlineimap dies.  That's a slightly more robust approach
> (and there's a number of tools out there that generalize the
> solution).
> 
> Is wrapping offlineimap with a restarter/logger the preferred way to
> get this functionality?
> 
> -- begin --
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.2/site-packages/offlineimap/threadutil.py", line 
> 115, in run
>     Thread.run(self)
>   File "/usr/lib/python2.2/threading.py", line 396, in run
>     apply(self.__target, self.__args, self.__kwargs)
>   File "/usr/lib/python2.2/site-packages/offlineimap/syncmaster.py", line 
> 137, in syncfolder
>     localfolder.syncmessagesto(statusfolder, [remotefolder, statusfolder])
>   File "/usr/lib/python2.2/site-packages/offlineimap/folder/Base.py", line 
> 291, in syncmessagesto
>     self.syncmessagesto_delete(dest, applyto)
>   File "/usr/lib/python2.2/site-packages/offlineimap/folder/Base.py", line 
> 254, in syncmessagesto_delete
>     object.deletemessages(deletelist)
>   File "/usr/lib/python2.2/site-packages/offlineimap/folder/IMAP.py", line 
> 244, in deletemessages
>     self.addmessagesflags(uidlist, ['T'])
>   File "/usr/lib/python2.2/site-packages/offlineimap/folder/IMAP.py", line 
> 204, in addmessagesflags
>     imaputil.flagsmaildir2imap(flags))
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 665, 
> in uid
>     typ, dat = apply(self._simple_command, (name, command) + args)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 968, 
> in _simple_command
>     return self._command_complete(name, apply(self._command, (name,) + args))
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 798, 
> in _command_complete
>     typ, data = self._get_tagged_response(tag)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 899, 
> in _get_tagged_response
>     self._get_response()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 816, 
> in _get_response
>     resp = self._get_line()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 909, 
> in _get_line
>     line = self.readline()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 234, 
> in readline
>     return self.file.readline()
> IOError: [Errno 104] Connection reset by peer
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.2/site-packages/offlineimap/threadutil.py", line 
> 115, in run
>     Thread.run(self)
>   File "/usr/lib/python2.2/threading.py", line 396, in run
>     apply(self.__target, self.__args, self.__kwargs)
>   File "/usr/lib/python2.2/site-packages/offlineimap/syncmaster.py", line 53, 
> in syncaccount
>     remoterepos.syncfoldersto(localrepos)
>   File "/usr/lib/python2.2/site-packages/offlineimap/repository/Base.py", 
> line 40, in syncfoldersto
>     srcfolders = src.getfolders()
>   File "/usr/lib/python2.2/site-packages/offlineimap/repository/IMAP.py", 
> line 57, in getfolders
>     imapobj = self.imapserver.acquireconnection()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imapserver.py", line 
> 168, in acquireconnection
>     imapobj = UsefulIMAP4(self.hostname, self.port)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 153, 
> in __init__
>     self.open(host, port)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 221, 
> in open
>     self.sock.connect((host, port))
> gaierror: (-3, 'Temporary failure in name resolution')
> 
> Traceback (most recent call last):
>   File "/usr/lib/python2.2/site-packages/offlineimap/threadutil.py", line 
> 115, in run
>     Thread.run(self)
>   File "/usr/lib/python2.2/threading.py", line 396, in run
>     apply(self.__target, self.__args, self.__kwargs)
>   File "/usr/lib/python2.2/site-packages/offlineimap/syncmaster.py", line 53, 
> in syncaccount
>     remoterepos.syncfoldersto(localrepos)
>   File "/usr/lib/python2.2/site-packages/offlineimap/repository/Base.py", 
> line 40, in syncfoldersto
>     srcfolders = src.getfolders()
>   File "/usr/lib/python2.2/site-packages/offlineimap/repository/IMAP.py", 
> line 59, in getfolders
>     listresult = imapobj.list(directory = self.imapserver.reference)[1]
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 457, 
> in list
>     typ, dat = self._simple_command(name, directory, pattern)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 968, 
> in _simple_command
>     return self._command_complete(name, apply(self._command, (name,) + args))
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 798, 
> in _command_complete
>     typ, data = self._get_tagged_response(tag)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 899, 
> in _get_tagged_response
>     self._get_response()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 816, 
> in _get_response
>     resp = self._get_line()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 909, 
> in _get_line
>     line = self.readline()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 234, 
> in readline
>     return self.file.readline()
> IOError: [Errno 110] Connection timed out
> 
> Thread 'Account sync wordzoo' terminated with exception:
> Traceback (most recent call last):
>   File "/usr/lib/python2.2/site-packages/offlineimap/threadutil.py", line 
> 115, in run
>     Thread.run(self)
>   File "/usr/lib/python2.2/threading.py", line 396, in run
>     apply(self.__target, self.__args, self.__kwargs)
>   File "/usr/lib/python2.2/site-packages/offlineimap/syncmaster.py", line 53, 
> in syncaccount
>     remoterepos.syncfoldersto(localrepos)
>   File "/usr/lib/python2.2/site-packages/offlineimap/repository/Base.py", 
> line 40, in syncfoldersto
>     srcfolders = src.getfolders()
>   File "/usr/lib/python2.2/site-packages/offlineimap/repository/IMAP.py", 
> line 59, in getfolders
>     listresult = imapobj.list(directory = self.imapserver.reference)[1]
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 457, 
> in list
>     typ, dat = self._simple_command(name, directory, pattern)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 968, 
> in _simple_command
>     return self._command_complete(name, apply(self._command, (name,) + args))
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 798, 
> in _command_complete
>     typ, data = self._get_tagged_response(tag)
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 899, 
> in _get_tagged_response
>     self._get_response()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 816, 
> in _get_response
>     resp = self._get_line()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 909, 
> in _get_line
>     line = self.readline()
>   File "/usr/lib/python2.2/site-packages/offlineimap/imaplib.py", line 234, 
> in readline
>     return self.file.readline()
> IOError: [Errno 113] No route to host
> 
> -- end --
> 
> -- jared@xxxxxxxxxxx
> 
> http://www.geekcode.com/geek.html
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.12
> GCM/CS/B
> d s:++>+ a-
> C++(++++)$ USL++++ P+++ L+++ E++(+++) W++++ N- !o !K w !O M V
> PS+++(-) PE++(--) Y+ PGP>++
> t@ 5 X+ R>+ tv++>-- b>++ DI+ D- G
> e++ h- r++>+++ y+++
> ------END GEEK CODE BLOCK------
> 


[Prev in Thread] Current Thread [Next in Thread]