Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue caused by calling F_SETLKW instead of F_SETLK #52

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

jwatson-gcu
Copy link
Contributor

Closes #51

Fix an issue where the AIX implementation uses F_SETLKW instead of F_SETLK for TryLock(). This causes TryLock() to wait indefinitely for a lock instead of returning with failure. See fcntl() Documentation

I could not figure a way to reproduce this issue with a Unit test. New go-routine did not trigger it, and spawning a separate process became messy real quick. I tested by hand both Lock() and TryLock() variants between two separate processes and it worked as expected.

Unit tests continue run pass successfully under AIX.

@jwatson-gcu jwatson-gcu mentioned this pull request Feb 25, 2021
@theckman
Copy link
Member

@Helflym I could probably use your 👀 on this one too since it's AIX.

@Helflym
Copy link

Helflym commented Feb 25, 2021

It looks good to me. I'm not sure there was any reason to use F_SETLK instead of F_SETLKW.

However, if you want a unit test, separate processes might be mandatory. Fcntl locks are based on "processes" while Flock locks are based on file descriptors. Thus, as goroutines are like threads, it's not a surprise that you can't reproduce it.

@jwatson-gcu
Copy link
Contributor Author

@theckman What is the next step in getting this PR merged? I have been using it in production for a few months now and have not run into any issues.

@theckman
Copy link
Member

theckman commented Jun 24, 2021

@jwatson-gcu I will be going through everything on this repo this weekend. You should see a new release then. Sorry for the delay.

@theckman theckman merged commit 6f010d1 into gofrs:master Jun 26, 2021
@theckman
Copy link
Member

v0.8.1 was just released. Thank you!

@jwatson-gcu jwatson-gcu deleted the bugs/fix-trylock-aix branch September 15, 2021 16:38
@ldez ldez added the bug label Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AIX TryLock() issue
4 participants