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.
Comment on Re^4: What the flock!? Concurrency issues in file writing.