I have a File::NFSLock issue that goes something like...

Two (or more) servers with shared NFS space both get a request to run some process. They both try to write an NFSLock. Due to timing issues, they could BOTH think they have the lock. Obviously, only one *really* has the lock, but as far as I can tell, you can't actually know which one does. So, they both run the process, even though only one needs to. The results of the process comes out correctly, but the issue is only that both servers run the process when one would suffice. Of course, once the lock is established, future requests are locked out in the correct way until the lock is released.

I was thinking that if a server could identify which one actually got the lock, at some point during the running process, it could periodically check if it were the owner of the lock. If it wasn't, it could gracefully stop the process and assume the one with the lock would finish correctly. Is there some reasonable way to do that?

I guess I mean it would need to write some extra metadata into the lock that it could retrieve to identify the actual "owner".

I'm sorry, I meant to say, that I have read the File::NFSLock documentation and there is no mention of being able to arbitrarily stuff data into it. I just meant if anyone had any other ideas on how to tackle this problem. Maybe I'm just posting here in the hopes someone has something enlightening and uplifting to say! :)


In reply to File::NFSLock owner identification? by SleepyJay

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.