Skip to content

AIX TryLock() issue #51

@jwatson-gcu

Description

@jwatson-gcu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions