in reply to Re: What the flock!? Concurrency issues in file writing.
in thread What the flock!? Concurrency issues in file writing.

But it should block indefinitely (hes not using LOCK_NB), so it shouldn't fail ... syswrite/seek still could :)
  • Comment on Re^2: What the flock!? Concurrency issues in file writing.

Replies are listed 'Best First'.
Re^3: What the flock!? Concurrency issues in file writing.
by moritz (Cardinal) on Oct 01, 2008 at 16:02 UTC
    If there were no failure conditions for flock, then I'm sure the documentation wouldn't say
    Returns true for success, false on failure

    I'm not quite sure what the exact failure condition is in which flock neither waits for the lock nor dies, but it seems to exist.

    (Update: It seems that it only will fail if LOCK_NB is used, but I'm not entirely sure).

      Yeah, flock can fail, but that's typically a case of running out of system resources; possibly, but rare. It doesn't seem the OP is describing a case that happens only third blue moon.

      It doesn't mean you shouldn't check the return value of flock, but I doubt that this is the cause of the problem.