Bug 568529 - Broken check pattern for submitting new indexer jobs
Summary: Broken check pattern for submitting new indexer jobs
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 09:47 EST by Andrey Loskutov CLA
Modified: 2020-11-17 12:42 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 09:47:51 EST
Another MT issue I've stumbled upon while debugging bug 566262.
A common pattern in the JDT indexer code is to check if there is already an indexing request for same library pending and to submit after that check.

However, the check is not atomic, means it is not inside any synchronized code:

if (!isJobWaiting(request))
	request(request);

Any thread can add new request between if condition is evaluated and request() call.

See for example
org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexLibrary(IPath, IProject, URL, boolean)
Comment 1 Andrey Loskutov CLA 2020-11-04 09:48:30 EST
I will push a patch.
Comment 2 Eclipse Genie CLA 2020-11-04 10:51:22 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/171749
Comment 4 Vikas Chandra CLA 2020-11-17 09:48:49 EST
verified by code inspection.

Andrey, any other way to verify this one?
Comment 5 Andrey Loskutov CLA 2020-11-17 12:42:58 EST
No.