Re: Problem with FileLock



On Fri, 13 Jul 2007 14:34:14 -0700, alejandrina wrote:
We need to update a file (on a file server) from many different
machines. To synchromize the updates I am using FileLock.

Everything works as advertised (ie if a machine gets the lock, it
writes to the file while the other machines wait, everything is
written in the proper order). The same test, using Linux machines,
fails: the file is clobbered (meaning one update gets on top of
another). No Exceptions are thrown; in fact the debug statements
indicate that all the machines are acquiring the exclusive lock)

If you are accessing the files over NFS, then I believe (but am not
sure) that

- the locks may be unknown to the server, and consequently to other
NFS clients.

- each client might be caching its updates, which are not guaranteed
to be visible to other clients without a close/open sequence in
between (if even then). This could result in corruption even if the
locking is in fact working as you expect it to.

What happens when you run two instances of your application on the
*same* host?

I would recommend that you update the file from a single (server)
process that does so on behalf of the other (client) processes, so the
updates are atomic and strictly serialized, without any need for
locking.

/gordon

--
.



Relevant Pages

  • Re: Problem with FileLock
    ... To synchromize the updates I am using FileLock. ... Everything works as advertised (ie if a machine gets the lock, ... writes to the file while the other machines wait, ... process that does so on behalf of the other (client) processes, ...
    (comp.lang.java.programmer)
  • Re: Software Update Tool Feature Pack Question
    ... The entire package would only be sent to the clients if you are using SMS ... 2003 and advanced clients and have the advertisement set to "download and ... You can create target collections by using queries based on missing updates ... > machines that need it. ...
    (microsoft.public.sms.swdist)
  • Re: Problem with FileLock
    ... To synchromize the updates I am using FileLock. ... writes to the file while the other machines wait, ... NFS clients. ... don't attempt file locking over NFS unless you have plenty of time ...
    (comp.lang.java.programmer)
  • Re: Problem with FileLock
    ... To synchromize the updates I am using FileLock. ... writes to the file while the other machines wait, ... NFS clients. ... don't attempt file locking over NFS unless you have plenty of time ...
    (comp.lang.java.programmer)
  • Re: SUS problems
    ... to install the Windows Update Client on your machines. ... I've installed SUS on a Windows> 2000 server and everything seems okay. ... I've also set my> clients to look at this server via registry entries for> Automatic Updates. ...
    (microsoft.public.windowsupdate)