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

deadlock in worker thread closing #2528

Open
tildejustin opened this issue Jun 4, 2024 · 1 comment
Open

deadlock in worker thread closing #2528

tildejustin opened this issue Jun 4, 2024 · 1 comment
Labels
A-mods Area: Mod compatibility S-confirmed Status: Confirmed

Comments

@tildejustin
Copy link

Bug Description

There is a potential deadlock during worker thread stopping that is exposed by FastReset (a speedrunning mod) that I was hoping could be fixed upstream. Since FastReset closes worlds on a separate thread, when worker threads are stopped there is a chance that they can lock again after they are all awakened but before they are all joined, as they are not necessarily already waiting for tasks at the moment of notify (likely due to FastReset). I fixed this in Speedrunning Sodium (Minecraft-Java-Edition-Speedrunning/sodium@6e22813) a bit ago and just assumed it was fixed upstream in the semaphore refactor without testing but this is not the case, as this thread dump shows https://mclo.gs/b9k0Bs0. Discussed a bit in discord already @ https://discord.com/channels/602796788608401408/651120262129123330/1247587665608577095.

Reproduction Steps

In 1.16.1, you could put a thread-only breakpoint in getNextJob right before the wait call and another after the notifyAll. I have not looked into reproducing in dev after the semaphore refactor but you could probably do something similar after queue#shutdown in ChunkBuilder.

Log File

log (different session, same mods, computer, deadlock): https://mclo.gs/yqj4lFo

Crash Report

thread dump: https://mclo.gs/b9k0Bs0

@tildejustin tildejustin added the S-needs-triage Status: Needs triage label Jun 4, 2024
@pajicadvance pajicadvance added A-mods Area: Mod compatibility S-confirmed Status: Confirmed and removed S-needs-triage Status: Needs triage labels Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mods Area: Mod compatibility S-confirmed Status: Confirmed
Projects
None yet
Development

No branches or pull requests

3 participants