-
Notifications
You must be signed in to change notification settings - Fork 68
Description
I found an issue with TryLock()
on AIX in the scenario where two separate programs are trying to lock the same file.
Scenario: Program A locks file /tmp/lock.file
with TryLock()
. While Program A is holding this lock, program B calls TryLock()
on the same file.
Expect: Program B should return from TryLock()
immediately, failing to obtain lock and nil error
Actual: Program B blocks indefinitely until program A releases the lock
I tested this on both Linux and Windows and they worked as I expected.
I ran the Unit Tests on AIX and they pass without issue. It appears to me that this scenario is tested for at flock_test.go:103
, but I am wondering if this is not the same scenario given the sys calls in the unit tests are made from the same process.
Update
I dug in a little deeper and figured out the issue. I am proposing a fix in #52