I have to start by admitting that I have now clue what exactly is wrong - except it forks under Fedora Core 2 and does not work under Red Hat Enterprize Linux AS v3 (fully up2date). Basically, I am installing the gallery package (http://gallery.sf.net/) and under Fedora Core 2 it works, while under Taroon Update 2 I keep getting "Error: Could not acquire lock (.../albums/.users/userdb.dat.lock)! Error: Could not acquire lock (.../albums/.users/1093249561_2125122209.lock)!" while in fact the lock file was succesfully created, but the actual .dat file is never created. ..
Update: this only happens when albums directory is on NFS. Also, there is somebody else who got similar problems after upgrading from RH7.3 to RHEL 3 - see http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&p=90761
Thanks for the report. Do you have the nfslock service running on both the NFS client and servers? (locking over NFS does not work without that)
The other user (see comment #1) who also got this problem also has his albums directory on NFS, so this may be a kernel issue. I do have the nfslock running on the client, and as for the server - I do not have access to it (also, the server is a NatApp's DataOnTap server, not Red Hat). I tried running the locking tests from the Connectathon NFS Testsuites and it succeeded (no errors, but 4 warnings).
The problem is that flock() is being used to try and lock the album files, and this doesn't work over NFS; this isn't a kernel bug.
I'm the other user, btw. I have checked the nfslock on my server, and it seems to be running just fine. In addition, it ran fine in the same environment in RH7.3 a week ago - so it can't just be an NFS thing. The lock files are created, but seem to be unable to delete themselves when done.
Yes, it's not relevant about nfslock. The Gallery application uses the flock() PHP function, which is documented to not work on NFS filesystems. http://www.us3.php.net/flock "" flock() will not work on NFS and many other networked file systems. Check your operating system documentation for more details. ""
There is a config option in Gallery to turn off locking support; edit config.php and search for "flock". Since the PHP flock() implementation seems to be by design, and is documented as such, this is not really a PHP bug, merely an (undocumented?) assumption in Gallery. We'll raise the issue with upstream as to whether flock() can be changed to use a locking scheme which is compatible with NFS.
> There is a config option in Gallery to turn off locking support; edit > config.php and search for "flock". Thanks a lot, setting $gallery->app->use_flock to "no" solved the problem for me!