nknganda / django-mailer

Automatically exported from code.google.com/p/django-mailer
MIT License
0 stars 0 forks source link

Acquiring lock fails on filesystems not supporting hardlinks. #22

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set up pinax on a filesystem which does not support hardlinks
2. Queue up some emails
3. run 'python manage.py send_mail'

What is the expected output? What do you see instead?

Expected:
queued mails are sent

Seen:
error saying that the lock is already acquired.

What version of the product are you using? On what operating system?

version pinax-0.5.1 on Linux. I use a filesystem which does not support
hardlinks (encfs via fuse on top of ext3).

Please provide any additional information below.

The culprit is in mailer/lockfile.py, starting from line 494:

494 if hasattr(os, "link"):
495     FileLock = LinkFileLock
496 else:
497     FileLock = MkdirFileLock

The check succeeds, since the _os_ supports hardlinks, but the filesystem
doesn't. What ends up happening is that link creation always fails, leading
to the already acquired error.

It should check by actually creating a link (temporary link to a temporary
file in the current directory) and figuring out capabilities based on the
success of that operation.

Original issue reported on code.google.com by gera...@gmail.com on 6 Feb 2009 at 10:21