Perrin Harkins [mailto:[EMAIL PROTECTED]] wrote:
> I think you'll still have problems with this technique, unless you
> tie/untie every time.  I'm looking at the perldoc for DB_File version
> 1.76, at the section titled "Locking: the trouble with fd".  At the very
> least, you'd have to call sync after acquiring a write lock but before
> writing anything.

Here is more information from the original discovery of the bug. This
contains the test cases that actually show the database corruption. Also
some documentation on the details such as systraces that show reading
happens before the flock system call.

   http://www.davideous.com/misc/dblockflaw-1.2.tar.gz
   http://www.davideous.com/misc/dblockflaw-1.2/

Sync may or may not work, depending on how the low level buffering is
implemented. If it re-reads all information from disk I don't think you have
any advantage over simply closing the DB_File and opening it again.

It's also worthwhile to use an external lock file because that properly
locks for database creation.

David Harris
President, DRH Internet Inc.
[EMAIL PROTECTED]
http://www.drh.net/



Reply via email to