Bug 574171 - Multiple tests deadlock after I20210611-2000
Summary: Multiple tests deadlock after I20210611-2000
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.21   Edit
Hardware: PC All
: P3 critical (vote)
Target Milestone: 4.21 M2   Edit
Assignee: Gayan Perera CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks: 570078
  Show dependency tree
 
Reported: 2021-06-13 10:53 EDT by Andrey Loskutov CLA
Modified: 2021-08-19 02:09 EDT (History)
4 users (show)

See Also:


Attachments
PDE tests log with thread dump (111.64 KB, text/plain)
2021-06-13 10:53 EDT, Andrey Loskutov CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2021-06-13 10:53:16 EDT
Created attachment 286583 [details]
PDE tests log with thread dump

Regression from bug 570078.
pde.ui.tests, ui.tests.navigator deadlock after I20210611-2000

See https://download.eclipse.org/eclipse/downloads/drops4/I20210612-1800/testResults.php

Stack of the main thread:

java.lang.Exception: ThreadDump for thread "main"
	at java.base@11.0.11/java.lang.Object.wait(Native Method)
	at java.base@11.0.11/java.lang.Object.wait(Object.java:328)
	at org.eclipse.jdt.internal.core.search.indexing.ReadWriteMonitor.enterWrite(ReadWriteMonitor.java:49)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.updateMetaIndex(IndexManager.java:1489)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.removeIndex(IndexManager.java:860)
	at org.eclipse.jdt.internal.core.JavaModelManager$PerProjectInfo.forgetExternalTimestampsAndIndexes(JavaModelManager.java:1319)
	at org.eclipse.jdt.internal.core.JavaModelManager.removePerProjectInfo(JavaModelManager.java:4286)
	at org.eclipse.jdt.internal.core.DeltaProcessor.checkProjectsAndClasspathChanges(DeltaProcessor.java:503)
	at org.eclipse.jdt.internal.core.DeltaProcessor.checkProjectsAndClasspathChanges(DeltaProcessor.java:591)
	at org.eclipse.jdt.internal.core.DeltaProcessor.resourceChanged(DeltaProcessor.java:2112)
	at org.eclipse.jdt.internal.core.DeltaProcessingState.resourceChanged(DeltaProcessingState.java:478)
	at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:305)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:295)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:158)
	at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:381)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1503)
	at org.eclipse.core.internal.resources.Resource.delete(Resource.java:791)
	at org.eclipse.core.internal.resources.Project.delete(Project.java:326)
	at org.eclipse.pde.ui.tests.ee.ExecutionEnvironmentTests.deleteProject(ExecutionEnvironmentTests.java:51)
	at org.eclipse.pde.ui.tests.ee.ExecutionEnvironmentTests.testCustomEnvironment(ExecutionEnvironmentTests.java:152)
Comment 1 Andrey Loskutov CLA 2021-06-13 11:19:27 EDT
The deadlock is between:

thread "Java indexing"
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.updateIndexState(IndexManager.java:1208)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager$MetaIndexSaveJob.execute(IndexManager.java:1579)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:414)
	at java.base@11.0.11/java.lang.Thread.run(Thread.java:829)

and 

thread "main"
	at java.base@11.0.11/java.lang.Object.wait(Native Method)
	at java.base@11.0.11/java.lang.Object.wait(Object.java:328)
	at org.eclipse.jdt.internal.core.search.indexing.ReadWriteMonitor.enterWrite(ReadWriteMonitor.java:49)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.updateMetaIndex(IndexManager.java:1489)
	at org.eclipse.jdt.internal.core.search.indexing.IndexManager.removeIndex(IndexManager.java:860)
	at org.eclipse.jdt.internal.core.JavaModelManager$PerProjectInfo.forgetExternalTimestampsAndIndexes(JavaModelManager.java:1319)

"Java indexing" called monitor.enterWrite() in MetaIndexSaveJob.execute(IProgressMonitor) and waits for the synchnronized lock to call in IndexManager.updateIndexState(IndexManager.java:1208)

"main" locked IndexManager.updateMetaIndex(IndexManager.java:1489) and waits for the other thread to release ReadWriteMonitor in ReadWriteMonitor.enterWrite(ReadWriteMonitor.java:49).
Comment 2 Eclipse Genie CLA 2021-06-13 11:28:28 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/181871
Comment 3 Andrey Loskutov CLA 2021-06-13 11:28:52 EDT
(In reply to Eclipse Genie from comment #2)
> New Gerrit change created:
> https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/181871

The simplest solution is to make updateMetaIndex non synchronized, the extra lock that seem to be not needed because the important part is locked already via RW lock.
Comment 4 Eclipse Genie CLA 2021-06-13 15:35:43 EDT
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/181878
Comment 6 Andrey Loskutov CLA 2021-07-12 01:40:48 EDT
Thanks Gayan.
Comment 7 Andrey Loskutov CLA 2021-07-12 15:15:06 EDT
I believe we should have bumped index version for JDT, to trigger re-indexing for existing workspaces.
I've just had an issue that I was not able to find implementors for org.eclipse.jdt.core.ICodeAssist.codeSelect(int, int) method in my main wokrspace on the new SDK build, and right after I've re-created JDT index that was found.
Comment 8 Andrey Loskutov CLA 2021-07-12 15:15:53 EDT
(In reply to Andrey Loskutov from comment #7)
> I believe we should have bumped index version for JDT, to trigger
> re-indexing for existing workspaces.
> I've just had an issue that I was not able to find implementors for
> org.eclipse.jdt.core.ICodeAssist.codeSelect(int, int) method in my main
> wokrspace on the new SDK build, and right after I've re-created JDT index
> that was found.

Wrong bug, sorry. Meant to be in bug 570078.
Comment 9 Manoj N Palat CLA 2021-08-19 02:09:11 EDT
Verified with Eclipse 4.21 M3 Version: 2021-09 (4.21) Build id: I20210818-1800