Bug 568535 - [indexer] JobManager.processingThread & JobManager.executing aren't volatile
Summary: [indexer] JobManager.processingThread & JobManager.executing aren't volatile
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.8.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.18 M3   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-04 12:07 EST by Andrey Loskutov CLA
Modified: 2020-11-17 09:50 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2020-11-04 12:07:32 EST
While debugging bug 566262 I've stumbled over this issue.

org.eclipse.jdt.internal.core.search.processing.JobManager.processingThread & org.eclipse.jdt.internal.core.search.processing.JobManager.executing is not volatile but are accessed from multiple threads, not always inside synchronized blocks => the threads may see a stale, not up-to-date version of the objects.

The code that uses this data in a wrong way is:

org.eclipse.jdt.internal.core.search.processing.JobManager.discardJobs(String)
org.eclipse.jdt.internal.core.search.processing.JobManager.shutdown()
org.eclipse.jdt.internal.core.search.processing.JobManager.run()
org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(IJob, int, IProgressMonitor)

I will push a patch.
Comment 1 Eclipse Genie CLA 2020-11-04 12:26:10 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/171758
Comment 3 Vikas Chandra CLA 2020-11-17 09:50:53 EST
verified by code inspection