I am experiencing a weird behavior from File::NFSLock in Perl v5.16. I am using stale lock timeout option as 5minutes. Let's say I have three processes. One of them took more than 5minutes before releasing a lock and process 2 got lock. However, even process 2 has lock for less than 5minutes, 3rd process is coming and removing the lock file causing the 2nd process to fail while removing NFSLock held by itself.
My theory says that process 3 wrongly read the last modified time of lock as that of written by process 1 and not process 2. I am writing nfs lock on partitions mounted on NFS.
Does anyone has an idea or faced similar issue with perl NFSLock? Please refer the below snapshot
my $lock = new File::NFSLock {file => $file,
lock_type => LOCK_EX,
blocking_timeout => 50, # 50 sec
stale_lock_timeout => 5 * 60};# 5 min
$DB::single = 1;
if ($lock) {
$lock->unlock()
}
If I block at debugger point for process 1 for more than 5 minutes, I am observing this behavior