Bug 568531 - Inconsistent JDT indexer task dispatching
Summary: Inconsistent JDT indexer task dispatching
Status: NEW
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: ---   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-04 10:24 EST by Andrey Loskutov CLA
Modified: 2023-01-14 14:53 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 10:24:07 EST
Another MT issue I've stumbled upon while debugging bug 566262, which is probably the main root cause for the bug 566262, but it is more generic, so I want to have it logged as a dedicated bug.

JDT has different ways to dispatch indexer tasks. Some of the tasks could be triggered by clients *directly & executed synchronously*, some of the tasks are created as "IndexRequest" objects, put in a queue via org.eclipse.jdt.internal.core.search.processing.JobManager.request(IJob) and executed at some time in the future.

It *seems* (from what I've seen so far) that most of various "add to index" tasks and only *some* of the "remove from index" tasks are executed asynchronously, however most of "remove from index" tasks are done immediately on same thread where it is requested by clients.

Therefore it is possible, that following sequence may produce errors because the "remove" tasks run in parallel to "add" tasks:

add "some/path" to index 
remove "some/path" from index
add "some/path" to index
remove "some/path" from index

As a result, we may may see various random bugs in indexer code - one from them is bug 566262, where the code tries to re-use same index file for reading that is at same time marked for deletion.

I believe the "right" solution for bugs like bug 566262 is to serialize indexer requests. As a bonus point we could skip "add to" indexer jobs that are interleaved with "remove from" for the same path.

I will try to proide a patch, but I can't guarantee it.
Comment 1 Eclipse Genie CLA 2020-11-04 16:42:12 EST
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/171776
Comment 2 Manoj N Palat CLA 2020-11-04 23:37:33 EST
@Andrey - seeing that you have given the gerrit, assigning to you so that this bug does not show up in the orphan list. thanks!
Comment 3 Eclipse Genie CLA 2023-01-14 14:53:58 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.