Fixed a crasher with "quickchanged" in next

Sebastian Spaeth Sebastian at SSpaeth.de
Sat Apr 21 11:39:33 UTC 2012


FYI, I just pushed commit 61e754c65ef08c85aa160b407d21475174c56262
to the next branch. If a select() would throw an Error while doing the
"quick" check on an IMAP server, we would try to free the same IMAP
connection twice, leading to a weird crash:

File "offlineimap/folder/IMAP.py", line 97, in quickchanged
    self.imapserver.releaseconnection(imapobj)
File "offlineimap/imapserver.py", line 118, in releaseconnection
    self.assignedconnections.remove(connection)
ValueError: list.remove(x): x not in list

Sebastian

commit 61e754c65ef08c85aa160b407d21475174c56262
    Do not try to release IMAP connection twice
    
    Reported by sharat87 in https://github.com/spaetz/offlineimap/pull/38,
    he would often get an unhandled Exception when trying to
    releaseconnection() a connection that was not in the pool of
    connections.
    
    The reason this could happen is that when folder.IMAP.quickchanged()
    raises an Exception in select(), we would release the connection in the
    "except" handling, and than release the same connection in the "finally"
    clause, which led to the error. The right thing is to only release the
    connection once, of course.
    
    Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/offlineimap-project/attachments/20120421/f94f032f/attachment.pgp>


More information about the OfflineIMAP-project mailing list