[ python-Bugs-1512163 ] mailbox (2.5b1): locking doesn't work (esp. on FreeBSD)
SourceForge.net
noreply at sourceforge.net
Tue Jun 27 00:56:10 CEST 2006
Bugs item #1512163, was opened at 2006-06-25 16:38
Message generated for change (Comment added) made by baikie
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1512163&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: David Watson (baikie)
Assigned to: A.M. Kuchling (akuchling)
Summary: mailbox (2.5b1): locking doesn't work (esp. on FreeBSD)
Initial Comment:
fcntl/flock() locking of mailboxes is actually disabled
due to a typo:
--- mailbox.py.orig
+++ mailbox.py
@@ -15,7 +15,7 @@
import rfc822
import StringIO
try:
- import fnctl
+ import fcntl
except ImportError:
fcntl = None
However, once enabled, it doesn't work on FreeBSD - the
lock() method always raises ExternalClashError (tested
on 5.3). This is because flock(), lockf() and fcntl
locking share the same underlying mechanism on this
system (and probably others), and so the second lock
can never be acquired.
----------------------------------------------------------------------
>Comment By: David Watson (baikie)
Date: 2006-06-26 23:56
Message:
Logged In: YES
user_id=1504904
Yeah, it works fine now (locks successfully when the mailbox
isn't locked by another process, and fails when it is
locked), although I was reminded that the Python install
process didn't work properly (I've submitted another bug
report).
However, I should point out that flock() locking is required
when working with qmail on (for example) Linux - flock() is
the only locking mechanism it uses, and as noted below,
flock() on Linux is independent from fcntl/lockf().
----------------------------------------------------------------------
Comment By: A.M. Kuchling (akuchling)
Date: 2006-06-26 14:27
Message:
Logged In: YES
user_id=11375
Typo fixed in rev. 47099; flock() calls removed in rev.
47100; a test for lock conflicts added in rev. 47101.
David, please try out the current SVN head and let me know
if matters have improved. I'll wait to see the buildbot
reports before closing this bug.
(Surprisingly, we don't seem to have a FreeBSD buildbot,
though we do have an OpenBSD one that didn't seem to have a
problem with the original version of the mailbox code.)
----------------------------------------------------------------------
Comment By: A.M. Kuchling (akuchling)
Date: 2006-06-26 13:56
Message:
Logged In: YES
user_id=11375
Interesting. The man page for flock() on my Linux system
says of flock() in a certain version: "This yields true
BSD semantics: there is no interaction
between the types of lock placed by flock(2) and fcntl(2),
and flock(2) does not detect deadlock." Apparently this is
out of date, and placing two locks is harmful.
I think it's best to just use one set of locking primitives,
and that one should be lockf(); the flock() calls should be
removed.
----------------------------------------------------------------------
Comment By: Neal Norwitz (nnorwitz)
Date: 2006-06-25 20:52
Message:
Logged In: YES
user_id=33168
Andrew, are you helping maintain this module? David is
correct that fcntl is mispelled in current svn. Not sure
what to do about the locking issue.
David, would it be possible for you to work on a patch to
correct this problem? I'm not sure if any developer has
access to a FreeBSD box similar to yours. (There are a
couple that use FreeBSD though.) It would be great to come
up with tests for this if the current ones don't stress this
situation.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1512163&group_id=5470
More information about the Python-bugs-list
mailing list