Bug 212234 - JobManager calling Thread.sleep in possibly infinite loop on UI thread
Summary: JobManager calling Thread.sleep in possibly infinite loop on UI thread
Status: VERIFIED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-06 23:55 EST by Cameron Bateman CLA
Modified: 2007-12-12 10:34 EST (History)
2 users (show)

See Also:


Attachments
Result of enabling debug tracing on the index manager when reproducing the (apparent) deadlock on the UI thread. (93.09 KB, text/plain)
2007-12-11 14:27 EST, Cameron Bateman CLA
no flags Details
Traces of UI and both IndexManager threads from the debugger. (4.90 KB, text/plain)
2007-12-11 14:27 EST, Cameron Bateman CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron Bateman CLA 2007-12-06 23:55:37 EST
I am seeing a test appear to hang in the 1204 build when I close a project.  The project close eventually invokes discardJobs which sits in a tight loop calling Thread.sleep(50) with no apparent guarantee that the loop will ever exit.  The close operation is occurring on the UI (main) thread.
Comment 1 Jerome Lanneluc CLA 2007-12-07 04:45:27 EST
Any steps to reproduce the problem.
Also a thread dump (of the Java Indexing thread) would help.
Comment 2 Cameron Bateman CLA 2007-12-07 14:21:18 EST
The problem occurs in JUnit tests that create, test and then close a significant (over 400 but the problem manifests after less than half that) number of Dynamic Web Project, which in this case are Java 5 projects create using the WTP facet mechanism.

Below is  stack trace copied from the debugger

Thread [main] (Suspended)	
	Thread.sleep(long) line: not available [native method]	
	IndexManager(JobManager).discardJobs(String) line: 95	
	DeltaProcessor.updateCurrentDeltaAndIndex(IResourceDelta, int, DeltaProcessor$RootInfo) line: 2371	
	DeltaProcessor.traverseDelta(IResourceDelta, int, DeltaProcessor$RootInfo, DeltaProcessor$OutputsInfo) line: 2041	
	DeltaProcessor.processResourceDelta(IResourceDelta) line: 1779	
	DeltaProcessor.resourceChanged(IResourceChangeEvent) line: 1923	
	DeltaProcessingState.resourceChanged(IResourceChangeEvent) line: 389	
	NotificationManager$2.run() line: 282	
	SafeRunner.run(ISafeRunnable) line: 37	
	NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 276	
	NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 148	
	Workspace.broadcastPostChange() line: 313	
	Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1022	
	Project.close(IProgressMonitor) line: 179	
	PropertiesOfMapsTestCase(BaseTestCase).tearDown() line: 218	
	PropertiesOfMapsTestCase(SingleJSPTestCase).tearDown() line: 73	
	PropertiesOfMapsTestCase(TestCase).runBare() line: 136	
	TestResult$1.protect() line: 106	
	TestResult.runProtected(Test, Protectable) line: 124	
	TestResult.run(TestCase) line: 109	
	PropertiesOfMapsTestCase(TestCase).run(TestResult) line: 120	
	ConfigurableTestSuite(TestSuite).runTest(Test, TestResult) line: 230	
	ConfigurableTestSuite.runTest(Test, TestResult) line: 56	
	ConfigurableTestSuite(TestSuite).run(TestResult) line: 225	
	ConfigurableTestSuite(TestSuite).runTest(Test, TestResult) line: 230	
	ConfigurableTestSuite.runTest(Test, TestResult) line: 56	
	ConfigurableTestSuite(TestSuite).run(TestResult) line: 225	
	TestSuite.runTest(Test, TestResult) line: 230	
	TestSuite.run(TestResult) line: 225	
	JUnit3TestReference.run(TestExecution) line: 130	
	TestExecution.run(ITestReference[]) line: 38	
	RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 460	
	RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 673	
	RemotePluginTestRunner(RemoteTestRunner).run() line: 386	
	RemotePluginTestRunner.main(String[]) line: 58	
	UITestApplication$1.run() line: 122	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 130	
	Display.runAsyncMessages(boolean) line: 3727	
	Display.readAndDispatch() line: 3364	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2381	
	Workbench.runUI() line: 2345	
	Workbench.access$4(Workbench) line: 2211	
	Workbench$4.run() line: 473	
	Realm.runWithDefault(Realm, Runnable) line: 288	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 468	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	UITestApplication.start(IApplicationContext) line: 52	
	EclipseAppHandle.run(Object) line: 193	
	EclipseAppLauncher.runApplication(Object) line: 106	
	EclipseAppLauncher.start(Object) line: 76	
	EclipseStarter.run(Object) line: 362	
	EclipseStarter.run(String[], Runnable) line: 175	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
	Main.invokeFramework(String[], URL[]) line: 561	
	Main.basicRun(String[]) line: 501	
	Main.run(String[]) line: 1239	
	Main.main(String[]) line: 1215	
Thread [main] (Suspended)	
	Thread.sleep(long) line: not available [native method]	
	IndexManager(JobManager).discardJobs(String) line: 95	
	DeltaProcessor.updateCurrentDeltaAndIndex(IResourceDelta, int, DeltaProcessor$RootInfo) line: 2371	
	DeltaProcessor.traverseDelta(IResourceDelta, int, DeltaProcessor$RootInfo, DeltaProcessor$OutputsInfo) line: 2041	
	DeltaProcessor.processResourceDelta(IResourceDelta) line: 1779	
	DeltaProcessor.resourceChanged(IResourceChangeEvent) line: 1923	
	DeltaProcessingState.resourceChanged(IResourceChangeEvent) line: 389	
	NotificationManager$2.run() line: 282	
	SafeRunner.run(ISafeRunnable) line: 37	
	NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 276	
	NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 148	
	Workspace.broadcastPostChange() line: 313	
	Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1022	
	Project.close(IProgressMonitor) line: 179	
	PropertiesOfMapsTestCase(BaseTestCase).tearDown() line: 218	
	PropertiesOfMapsTestCase(SingleJSPTestCase).tearDown() line: 73	
	PropertiesOfMapsTestCase(TestCase).runBare() line: 136	
	TestResult$1.protect() line: 106	
	TestResult.runProtected(Test, Protectable) line: 124	
	TestResult.run(TestCase) line: 109	
	PropertiesOfMapsTestCase(TestCase).run(TestResult) line: 120	
	ConfigurableTestSuite(TestSuite).runTest(Test, TestResult) line: 230	
	ConfigurableTestSuite.runTest(Test, TestResult) line: 56	
	ConfigurableTestSuite(TestSuite).run(TestResult) line: 225	
	ConfigurableTestSuite(TestSuite).runTest(Test, TestResult) line: 230	
	ConfigurableTestSuite.runTest(Test, TestResult) line: 56	
	ConfigurableTestSuite(TestSuite).run(TestResult) line: 225	
	TestSuite.runTest(Test, TestResult) line: 230	
	TestSuite.run(TestResult) line: 225	
	JUnit3TestReference.run(TestExecution) line: 130	
	TestExecution.run(ITestReference[]) line: 38	
	RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 460	
	RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 673	
	RemotePluginTestRunner(RemoteTestRunner).run() line: 386	
	RemotePluginTestRunner.main(String[]) line: 58	
	UITestApplication$1.run() line: 122	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 130	
	Display.runAsyncMessages(boolean) line: 3727	
	Display.readAndDispatch() line: 3364	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2381	
	Workbench.runUI() line: 2345	
	Workbench.access$4(Workbench) line: 2211	
	Workbench$4.run() line: 473	
	Realm.runWithDefault(Realm, Runnable) line: 288	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 468	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	UITestApplication.start(IApplicationContext) line: 52	
	EclipseAppHandle.run(Object) line: 193	
	EclipseAppLauncher.runApplication(Object) line: 106	
	EclipseAppLauncher.start(Object) line: 76	
	EclipseStarter.run(Object) line: 362	
	EclipseStarter.run(String[], Runnable) line: 175	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25	
	Method.invoke(Object, Object...) line: 585	
	Main.invokeFramework(String[], URL[]) line: 561	
	Main.basicRun(String[]) line: 501	
	Main.run(String[]) line: 1239	
	Main.main(String[]) line: 1215	
Comment 3 Frederic Fusier CLA 2007-12-08 04:33:22 EST
It would be also helpful to activate the IndexManager trace to give us some more clues and have a chance to figure out what happens there.

Could you use '-consoleLog -debug <dir>/.options' arguments in your eclipse command line after having added/modified the following lines in the .options file:

# Turn on debug tracing for org.eclipse.jdt.core plugin
org.eclipse.jdt.core/debug=true
# Reports background indexer activity: indexing, saving index file, index queries
org.eclipse.jdt.core/debug/indexmanager=true

Then, in the DOS Command windows, copy the console outputs, paste them in a file and attach this file to this bug.

TIA
Comment 4 Jerome Lanneluc CLA 2007-12-10 09:15:04 EST
(In reply to comment #2)
This is a thread dump of the 'main' thread. I would need a thread dump of the 'Java indexing' thread.
Comment 5 Cameron Bateman CLA 2007-12-11 14:27:06 EST
Created attachment 84999 [details]
Result of enabling debug tracing on the index manager when reproducing the (apparent) deadlock on the UI thread.
Comment 6 Cameron Bateman CLA 2007-12-11 14:27:52 EST
Created attachment 85000 [details]
Traces of UI and both IndexManager threads from the debugger.
Comment 7 Jerome Lanneluc CLA 2007-12-12 10:18:39 EST
It looks like the code you are running has been modified: it calls JavaProject.getJSDTScopeFile() which doesn't exist in the 1204 build.
Closing as invalid. Please reopen if you reproduce with a pure Eclipse build.
Comment 8 Jerome Lanneluc CLA 2007-12-12 10:19:12 EST
Closing as INVALID
Comment 9 Frederic Fusier CLA 2007-12-12 10:34:26 EST
Verified for 3.4M4