Hi, monks
Some time ago I developed a Windows Service based system for transferring data between servers on our network. All has been running quite nicely now for almost a year, with one glaring exception. About once every two - three months, a thread will fail when attempting to open a file. As a point of context, there are 5 threads performing the work which run non-stop while the server is on (each thread executing the affected lines of code several thousand times per day). The servers are rebooted once a week and the service is only restarted when the reboot occurs.
The error I get is:
Thread 10 terminated abnormally: Failed to open \\server\share\INQUEUE\loadqueue.lck: Invalid argument at service.plx line 596.The relevant code (lines 595 and 596) are:
my $lockfile = $destDir."loadqueue.lck"; open my $fhLock, ">", $lockfile or die "Failed to open $lockfile: $!" +;
Any suggestions on why this code is failing would be highly appreciated. I guess the obvious work around would be something like this:
but without understanding why this error might be occurring, I'm a bit wary of doing this.my $lockfile = $destDir."loadqueue.lck"; my $fhLock; do { eval { open $fhLock, ">", $lockfile or die "Failed to open $lock +file: $!" } } until (defined $fhLock);
In reply to Problem opening file by SimonPratt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |