Dirk Wallenstein | 22 Jul 2012 13:41
Picon

Crash in LocalStatus.py when removing the tmp file

Hi,
I don't think the LocalStatusFolder().savelock lock is properly shared among
threads, or there can be multiple instances for the same folder.

https://github.com/nicolas33/offlineimap/blob/master/offlineimap/folder/LocalStatus.py#L34

I get this after a few messages:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/offlineimap/threadutil.py",
line 156, in run
    Thread.run(self)
  File "/usr/lib64/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Base.py",
line 324, in copymessageto
    statusfolder.savemessage(uid, None, flags, rtime)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatus.py",
line 128, in savemessage
    self.save()
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatus.py",
line 100, in save
    os.rename(self.filename + ".tmp", self.filename)
OSError: [Errno 2] No such file or directory

I didn't look much into it but tried to use one single lock for all
and it worked.

_______________________________________________
OfflineIMAP-project mailing list
(Continue reading)

Sebastian Spaeth | 31 Aug 2012 22:48
Picon

Re: Crash in LocalStatus.py when removing the tmp file

Dirk Wallenstein <dirk.impersonator <at> gmail.com> writes:

> I don't think the LocalStatusFolder().savelock lock is properly shared among
> threads, or there can be multiple instances for the same folder.

>   File "/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatus.py",
> line 100, in save
>     os.rename(self.filename + ".tmp", self.filename)
> OSError: [Errno 2] No such file or directory
>
> I didn't look much into it but tried to use one single lock for all
> and it worked.

Yes, this has been reported a few times now. The only case where the
lock would not work is if there were several instances of the
LocalStatusFolder representing a single folder or pointing to the same
filename, which is something that should not happen at all. 

So using a global lock would certainly paper over some real bug, obviously.

I never see these errors, so I have a hard time reproducing this. Could you
find out if there are several LocalStatusFolder instances created for
the same folder for you?

Some help would be appreciated in this case :)

Sebastian

_______________________________________________
OfflineIMAP-project mailing list
(Continue reading)

Sebastian Spaeth | 1 Sep 2012 01:25
Picon

Re: Crash in LocalStatus.py when removing the tmp file

Sebastian Spaeth <Sebastian <at> SSpaeth.de> writes:

> Dirk Wallenstein <dirk.impersonator <at> gmail.com> writes:
>
>> I don't think the LocalStatusFolder().savelock lock is properly shared among
>> threads, or there can be multiple instances for the same folder.
>
>>   File "/usr/lib/python2.7/site-packages/offlineimap/folder/LocalStatus.py",
>> line 100, in save
>>     os.rename(self.filename + ".tmp", self.filename)
>> OSError: [Errno 2] No such file or directory

Had a look at it. We would recreate a new Folder instance every time we
asked for it via getfolder("name"), even if the name is the same. This
could have led to 2 instances of LocalStatus folders pointing to the
same file hanging around simultanously.

I have pushed a change to the next branch to cache and reuse instances
when we ask for them again. Can you try the "next" branch and see if you
still see those errors?

Sebastian
_______________________________________________
OfflineIMAP-project mailing list
OfflineIMAP-project <at> lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project

OfflineIMAP homepage: http://software.complete.org/offlineimap
(Continue reading)


Gmane