-
Notifications
You must be signed in to change notification settings - Fork 47
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
Potential deadlock in acquiring chunk locks for features chunks #2
Labels
bug
Something isn't working
Comments
All generation task scheduling is done on a single thread executor. So there isnt't the case where multiple threads are executing this method. It is a good idea to clean up this dirty method though. |
Locks are not acquired synchronously though: the thread will yield to other tasks if it encounters an acquired lock. |
Closed
Closed
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From what I can tell, there seems to be the potential for a deadlock to occur when acquiring chunk locks for loading the features chunk status. This can happen given locks are acquired sequentially: if two chunks are acquiring the same locks at the same time, they can end up in a state where they both have acquired some of their locks, but the other thread holds the rest that they need. This causes no progression to be possible, given they are both waiting on each other to release the locks.
Working around this would require atomically ensuring that all locks are available before acquisition, but I'm not sure how this would work with the
asyncutil
library.https://github.com/YatopiaMC/barium-fabric/blob/e05b0cd6b08dd3828b8c96aa6c4f36dda9112af9/src/main/java/org/yatopiamc/barium/common/threading/worldgen/ChunkStatusUtils.java#L35-L54
The text was updated successfully, but these errors were encountered: