in reply to Re^2: Problem opening file
in thread Problem opening file

Okay. Try adding $^E to your logging; it might make for a clearer picture.

It would be easier to suggest something if you posted the thread code, but at a very minimum I'd rewrite that open something like this:

my $retries = 5; my $fhLock; while( $retries and not open $fhLock, ">", $lockfile ) { warn "Failed to open $lockfile: $! [$^E]"; sleep 1; --$retries; }

And then wait until it happens again. That should tell you whether its a temporary, transitory problem or not; and perhaps shed more light on the cause.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
I'm with torvalds on this Agile (and TDD) debunked I told'em LLVM was the way to go. But did they listen!

Replies are listed 'Best First'.
Re^4: Problem opening file
by SimonPratt (Friar) on Jul 10, 2015 at 10:27 UTC

    Thanks for your suggestions, I've rewritten the open call as per your and marinersk's suggestions and will also add $^E to the output.

    I'll have a chat with the boss today as to how much of the code I can share with you and try to get another update in after lunch