Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have many processes running via LSF and trying to read and write the same file. I have used flock everywhere, LOCK_SH for reads and LOCK_EX for writes. This usually works. But every now and then I get a failure.
open LOGFILE, ">>$logfile" or die("can't open"); flock(LOGFILE, LOCK_EX) or die("can't lock ($!)")
gives me "can't lock (Input/output error)". I can't reproduce this in a simple test case. My simple test cases always work. Any idea what would cause flock to fail in this way? What does "Input/output error" from a flock failure mean?

Replies are listed 'Best First'.
Re: flock "Input/output error"
by Anonymous Monk on Jan 21, 2009 at 04:27 UTC
    Probably means LSF or whatever doesn't support flock
      It is not so simple as "not supported". It usually works and only occasionally fails. LSF (Load Sharing Facility) is just a mechanism for controlling and dispatching multiple jobs to linux servers. The significance of the LSF component is just that multiple jobs on multiple machines may be trying to access the same file. Also, the "Input/output error" sounds like a very different message than I would get if it were not supported at all.
        Maybe LSF logs have a clue what it means