eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Syncronization in JavaModelManager.PerProjectInfo looks fishy

Open
#4,239 2 comments 0 reactions 1 assignee Claimed by @jarthana View on GitHub
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 12h
Merged PRs (30d)
47

Description

If one looks at this code in PerProjectInfo

https://github.com/eclipse-jdt/eclipse.jdt.core/blob/8944c910d454bf2c5656d186b09a3efc33733fc8/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java#L1397-L1410

there is a possible synchronization problem.

Assume two threads are entering the method and the first one enters the synchronized and advances to line 1405 and now the second thread goes to line 1397 then it might fetch a delta state that contains new values for

- referencedEntries
- newRawClasspath
- newOutputLocation
- rawClasspathStatus

but old one for `resolvedClasspath` and following...

So either there is a race condition here, or only one thread is ever calling the method so the synchronized is obsolete.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.