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

Synchronize the access to LRUCache #978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ramele1907
Copy link

  • a wizard that is creating multiple cdt projects encounters ConcurrentModificationException

@jonahgraham
Copy link
Member

Hi @ramele1907 - thanks for the PR. Unfortunately the code as provided doesn't compile. See build ouput for more details.

findPathInProjectCache has some more complicated semantics as it is a map of maps, so the inner map probably needs synchronizing too. e.g. add additional Collections.synchronizedMap around the new LRUCache in findPathInProject.

Because # of reads far outweigh number of writes and you indicated that multiple projects are being created simultaneously, did you consider concurrency instead of synchronizing all accesses to the map? Those caches were added in 9e7b5be to dramatically speed up the code, and I think that adding synchronized around each read access may have an unintentional slowdown. If you can demonstrate that synchronizedMap doesn't (seriously) negatively affect performance (see the lined commit for some stats) then we don't need to consider concurrency.

It would help if there is a way to reproduce the problem so that we can see the problem in action.

@jonahgraham
Copy link
Member

@ramele1907 Would you like to have a look at this and see if you can resolve the compile errors and other comments I made in my preliminary review #978 (comment)

- a wizard that is creating multiple cdt projects encounters
ConcurrentModificationException
@ramele1907
Copy link
Author

@jonahgraham I resolved the compile errors. I will try to use concurrency instead of synchronization to avoid performance issues.

Regarding the reproduction topic I will try to create a mock plugin with a wizard that creates multiple projects.

@jonahgraham
Copy link
Member

@jonahgraham I resolved the compile errors.

Great - I will set the build off running. On your next update please update to the latest HEAD of the main branch.

I will try to use concurrency instead of synchronization to avoid performance issues

I'm pleased you found concurrency easy enough to do. Did you calculate the performance issue? Was it significant?

Regarding the reproduction topic I will try to create a mock plugin with a wizard that creates multiple projects.

Wonderful! I recently did something similar by creating an example CMake project wizard that isn't shipped to customers, but demonstrates how to make custom wizards. See https://github.com/eclipse-cdt/cdt/blob/main/NewAndNoteworthy/CDT-12.0.md#cmake-support-easier-for-extenders-and-isvs

@jonahgraham
Copy link
Member

Also did you see this comment from my original review #978 (comment)?

findPathInProjectCache has some more complicated semantics as it is a map of maps, so the inner map probably needs synchronizing too. e.g. add additional Collections.synchronizedMap around the new LRUCache in findPathInProject.

I am relying on you to verify that my statement is true (that the inner maps need addressing)

Copy link

github-actions bot commented Feb 2, 2025

Test Results

   600 files  ±0     600 suites  ±0   13m 15s ⏱️ -6s
10 206 tests ±0  10 183 ✅ ±0  23 💤 ±0  0 ❌ ±0 
10 244 runs  ±0  10 221 ✅ ±0  23 💤 ±0  0 ❌ ±0 

Results for commit 7d47221. ± Comparison against base commit c8e47b3.

@jonahgraham jonahgraham added this to the 12.0.0 M3 milestone Feb 2, 2025
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.

2 participants