Bug 509558 - [newindex] Deadlock risk between Indexer thread and threads that call Indexer.waitForIndex
Summary: [newindex] Deadlock risk between Indexer thread and threads that call Indexer...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 510212
Blocks: 149975
  Show dependency tree
 
Reported: 2016-12-20 23:22 EST by Stefan Xenos CLA
Modified: 2023-03-15 17:43 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Xenos CLA 2016-12-20 23:22:54 EST
It's common for threads to call waitForJoin within a workspace lock.

The indexer calls some JDT model APIs that obtain the workspace lock.

waitForIndex uses Thread.join to block the caller on the indexer.

Thread.join doesn't allow locks to be shared between a caller of join and the joined thread. (See bug 509557)

As a result of the above, deadlocks are possible between the indexer and any thread that calls waitForIndex.

The deadlock can be resolved in two ways (possibly both):

- Move the responsibility of gathering the list of files to be indexed out of the indexer thread and into an external thread. Presumably, this responsibility would move to something like DeltaProcessor. The indexer would then be banned from invoking anything that obtains the workspace lock (which could be enforced by restoring the original patch for bug 508938).

- Change Thread.join to allow the joining thread to share its scheduling rules with the joined thread for the duration of the call to join (which is bug 509557).

Both of the above changes make sense on their own merits (the former would provide more efficient incremental indexing and the latter would prevent most deadlocks caused by join()) so it's possible we could do both.
Comment 1 Eclipse Genie CLA 2021-02-17 14:44:04 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.
Comment 2 Eclipse Genie CLA 2023-03-15 17:43:11 EDT
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.