Part of my last web application should write to the file as a sum as part of its logging. One of the problems that I noticed is that if there are several simultaneous users, the records can overwrite each other (instead of adding to the file). I assume this is because the destination file can be opened in several places at the same time.
flock(...) usually excellent, but it doesn’t work on NFS ... Which is a huge problem for me, since the production server uses an NFS array.
The closest thing I saw for the actual solution is trying to create a lock locator and wait until it is created. To say that this is a lack of elegance is an understatement of the year, perhaps a decade.
Any better ideas?
Edit: I have to add that I don’t have a root on the server, and it’s not always possible to do the repository in the near future, not least within my term.
source
share