Skip to content

Fine grain locking to avoid deadlocks in CU cache #1509

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

Closed
wants to merge 1 commit into from

Conversation

BoykoAlex
Copy link
Contributor

Only lock necessary pieces.

  1. Move project cache notifications outside the locked block
  2. Lock minimal pieces of code that use lookup environment

@BoykoAlex
Copy link
Contributor Author

BoykoAlex commented Mar 16, 2025

@martinlippert I was thinking merging this for 4.29.1 as well... but this might have some risk.

Can be reproduced in a workspace with a lot of spring boot projects. Once workspace is opened, invoke content assists and cancel it over and over again. Once in 3, 5 times completion proposals would be stuck at computing.
Deadlock are:

  • project added (lock on projects), CU cache invalidating the project (CU cache waiting on lookup env lock) and CU cache parsing a new CU (lock on lookup env) but waiting on the CU cache (shouldn't wait on the CU cache while parsing)
  • project added (lock on projects), CU cache invalidating (CU cache lock, waiting on lookup env lock) CU is processed (lookup env locked), i.e. hover and project for CU or any other URL but "projects" are locked

@martinlippert
Copy link
Member

If you have a good and reliable test scenario on your machine that keeps working with this change better than before, we can include this in 4.29.1, but beyond that, I would like to take a more careful look into the overall mechanism here. Looks quite complex to me, so looking into this again after 4.29.1 in more depth could make sense - in addition to the fix for 4.29.1.

@martinlippert martinlippert added type: bug for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: code completion labels Mar 17, 2025
@martinlippert martinlippert added this to the 4.29.1.RELEASE milestone Mar 17, 2025
@BoykoAlex
Copy link
Contributor Author

I've put this in for 4.29.1 via a081d8a

@BoykoAlex BoykoAlex closed this Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: code completion type: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants