Skip to content

Fix potential deadlock when triggering project refresh while holding write lock#2595

Open
embeddedt wants to merge 1 commit intominecraft-dev:devfrom
embeddedt:deadlock-fixes
Open

Fix potential deadlock when triggering project refresh while holding write lock#2595
embeddedt wants to merge 1 commit intominecraft-dev:devfrom
embeddedt:deadlock-fixes

Conversation

@embeddedt
Copy link

The common problem among all the stacktraces I looked at is a deadlock occuring when a thread holding the write lock tries to access the AWT or the write intent lock. My reading of the IntelliJ threading model documentation suggests this can be problematic. Since both of the two cases I found appear to be simple (triggering a project refresh), it seems that the simplest fix is to just queue the refresh call to be run later on the correct thread, independently of any write lock held by the surrounding method.

It will take some time to confirm if this actually fixes the problem, because it is impossible to reproduce reliably, hence why I resorted to stacktrace analysis.

In theory, this fixes #2566, fixes #2519 (there may also be other issue numbers I'm not aware of)

@Earthcomputer
Copy link
Member

Since your other PR contained the use of LLMs (nothing wrong with that if you yourself are competent and verify yourself that it's good), could you also let me know if you used LLMs for this PR as well?

@embeddedt
Copy link
Author

I used an LLM to point me in the direction of the locks, but ended up implementing the fix independently (its suggested solution was unnecessarily complex).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IDE freezes when opening existing project IntelliJ freezing upon loading multiple projects

2 participants