This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 217343 - Deadlocks creating runtime in Dynamic Web Project wizard
Summary: Deadlocks creating runtime in Dynamic Web Project wizard
Status: RESOLVED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: wst.common (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact: Konstantin Komissarchik CLA
URL:
Whiteboard: fix_ready
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-31 16:40 EST by Angel Vera CLA
Modified: 2008-02-04 10:40 EST (History)
3 users (show)

See Also:


Attachments
ThreadDump (9.43 KB, text/plain)
2008-01-31 16:40 EST, Angel Vera CLA
no flags Details
thread dump - comment #4 (24.89 KB, text/plain)
2008-02-01 11:24 EST, Kaloyan Raev CLA
no flags Details
Patch (round 2) (2.79 KB, text/plain)
2008-02-01 11:58 EST, Konstantin Komissarchik CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Angel Vera CLA 2008-01-31 16:40:44 EST
Created attachment 88469 [details]
ThreadDump

1. With an empty workspace start WTP.
2. Go to the JEE perspective
3. Using the Project Explorer context menu select New > Dynamic Web Project
4. Do not enter the name of the project yet
5. Click on the "New" button to create a Target Runtime
6. Select "Apache Tomcat v6.0" (I tested with v5.5 as well same behaviour)
7. Go through the wizard, and click on Finish
8. After the dialog closes WTP is frozen.

I was able to generate a a thread dump and I noticed a deadlock in main and thread 5: 

-------------------------->
2LKDEADLOCKTHR  Thread "main" (0x001DB500)
3LKDEADLOCKWTR    is waiting for:
4LKDEADLOCKMON      sys_mon_t:0x1325E1F8 infl_mon_t: 0x1325E230:
4LKDEADLOCKOBJ      java/lang/Object@04D6D1D8/04D6D1E4: 
3LKDEADLOCKOWN    which is owned by:
2LKDEADLOCKTHR  Thread "Thread-5" (0x16F16400)
3LKDEADLOCKWTR    which is waiting for:
4LKDEADLOCKMON      sys_mon_t:0x1325E1A4 infl_mon_t: 0x1325E1DC:
4LKDEADLOCKOBJ      org/eclipse/swt/widgets/RunnableLock@05A81B10/05A81B1C: 
3LKDEADLOCKOWN    which is owned by:
2LKDEADLOCKTHR  Thread "main" (0x001DB500)

--------------------------
Comment 1 Angel Vera CLA 2008-01-31 16:49:09 EST
To workaround the problem I create a runtime first using the Preferences > Server > Installed Runtime, and then created a Server using that runtime, and at the end I created the Dynamic Webproject, this scenario didn't have a problem.
Comment 2 Chuck Bridgham CLA 2008-01-31 17:02:28 EST
Konstantin, can you take a look?
Comment 3 Konstantin Komissarchik CLA 2008-01-31 22:13:38 EST
Released fix into the 3.0 M5 code stream.
Comment 4 Kaloyan Raev CLA 2008-02-01 09:43:57 EST
This bug is still valid with build I20080201061906. 

The exact steps to reproduce (any deviation may not get to the problem):
1. Start IDE in an new empty workspace. 
2. Click the "Go to workbench" button in the Welcome view. 
3. Open the Java EE perspective.
4. Right-click in the Project Explorer view > New > Dynamic Web Project. 
5. Give a name in the Project name text field. 
6. Click the Target Runtime > New... button.
7. Select Apache Tomcat v6.0.
8. Leave "Create a new local server" unchecked. 
9. Click the Next button. 
10. Click the Browse button and select the folder where Tomcat is installed. 
11. Click the Finish button. 

Deadlock!
Comment 5 Konstantin Komissarchik CLA 2008-02-01 10:00:54 EST
Cannot reproduce from my dev workspace. According to the map files, this build should have the fix. I am downloading the build now to try it. In the meantime, if you see this issue again, please capture and attach a full thread dump, since it is likely a different problem.
Comment 6 Konstantin Komissarchik CLA 2008-02-01 10:43:47 EST
The deadlock that Kaloyan hit appears to be specific to Tomcat 6.0 (cannot be seen with Tomcat 5.5). Unclear why. It is a very different deadlock than the one that Angel ran into...

Thread [main] (Suspended)	
	FacetedProjectWorkingCopy.validate() line: 1699	
	WebFacetProjectCreationDataModelProvider(FacetProjectCreationDataModelProvider).validate(String) line: 434	
	WebFacetProjectCreationDataModelProvider(J2EEFacetProjectCreationDataModelProvider).validate(String) line: 183	
	DataModelImpl.validateProperty(String) line: 431	
	WebProjectFirstPage(DataModelWizardPage).validateProperty(String, Integer) line: 360	
	WebProjectFirstPage(DataModelWizardPage).validateControlsBase() line: 346	
	WebProjectFirstPage(DataModelWizardPage).validatePage(boolean) line: 323	
	DataModelWizardPage$1.run() line: 439	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 130	
	Display.runAsyncMessages(boolean) line: 3737	
	Display.readAndDispatch() line: 3374	
	WizardDialog(Window).runEventLoop(Shell) line: 825	
	WizardDialog(Window).open() line: 801	
	WizardShortcutAction.run() line: 94	
	WizardShortcutAction(Action).runWithEvent(Event) line: 498	
	ActionContributionItem.handleWidgetSelection(Event, boolean) line: 582	
	ActionContributionItem.access$2(ActionContributionItem, Event, boolean) line: 499	
	ActionContributionItem$5.handleEvent(Event) line: 410	
	EventTable.sendEvent(Event) line: 66	
	MenuItem(Widget).sendEvent(Event) line: 952	
	Display.runDeferredEvents() line: 3760	
	Display.readAndDispatch() line: 3371	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2392	
	Workbench.runUI() line: 2356	
	Workbench.access$4(Workbench) line: 2222	
	Workbench$4.run() line: 474	
	Realm.runWithDefault(Realm, Runnable) line: 288	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 469	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 106	
	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: 597	
	Main.invokeFramework(String[], URL[]) line: 564	
	Main.basicRun(String[]) line: 504	
	Main.run(String[]) line: 1251	
	Main.main(String[]) line: 1227	
Thread [Thread-3] (Suspended)	
	Object.wait(long) line: not available [native method]	
	RunnableLock(Object).wait() line: 485	
	UISynchronizer(Synchronizer).syncExec(Runnable) line: 182	
	UISynchronizer.syncExec(Runnable) line: 118	
	Display.syncExec(Runnable) line: 4183	
	WebProjectFirstPage(DataModelWizardPage).propertyChanged(DataModelEvent) line: 447	
	DataModelImpl.notifyListeners(DataModelEvent) line: 346	
	DataModelImpl.notifyPropertyChange(String, int) line: 337	
	WebFacetProjectCreationDataModelProvider$1.propertyChanged(DataModelEvent) line: 59	
	DataModelImpl.notifyListeners(DataModelEvent) line: 346	
	DataModelImpl.notifyPropertyChange(String, int) line: 337	
	WebFacetInstallDataModelProvider(J2EEModuleFacetInstallDataModelProvider).propertySet(String, Object) line: 103	
	WebFacetInstallDataModelProvider.propertySet(String, Object) line: 92	
	DataModelImpl.internalSetProperty(String, Object) line: 182	
	DataModelImpl.setProperty(String, Object) line: 172	
	FacetDataModelConfigAdapter.setProjectFacetVersion(IProjectFacetVersion) line: 42	
	FacetedProjectWorkingCopy.bindProjectFacetActionConfig(IProjectFacetVersion, Object) line: 1496	
	FacetedProjectWorkingCopy.createProjectFacetAction(Set<Action>, Type, IProjectFacetVersion) line: 1438	
	FacetedProjectWorkingCopy.refreshProjectFacetActions() line: 1524	
	FacetedProjectWorkingCopy.setProjectFacets(Set<IProjectFacetVersion>) line: 729	
	FacetedProjectWorkingCopy.setDefaultFacetsForRuntime(IRuntime) line: 771	
	WebProjectWizard(NewProjectDataModelFacetWizard).setRuntimeAndDefaultFacets(IRuntime) line: 238	
	NewProjectDataModelFacetWizard$2.propertyChanged(DataModelEvent) line: 211	
	DataModelImpl.notifyListeners(DataModelEvent) line: 346	
	DataModelImpl.notifyPropertyChange(String, int) line: 337	
	DataModelImpl.internalSetProperty(String, Object) line: 183	
	DataModelImpl.setProperty(String, Object) line: 172	
	DataModelFacetCreationWizardPage$2.run() line: 173	
Comment 7 Kaloyan Raev CLA 2008-02-01 11:24:03 EST
Created attachment 88588 [details]
thread dump - comment #4

I attach my thread dump. I think it is different from the one of Konstantin in comment #6.
Comment 8 Konstantin Komissarchik CLA 2008-02-01 11:58:27 EST
Created attachment 88598 [details]
Patch (round 2)

Ok, so all of these deadlock had one thing in common. They were all caused by the use of syncExec from non-UI thread in cases where a data structure lock is being held and the ui code tries to access the same data structure. Changing the syncExec calls to asyncExec took care of the problem.

I have tested with Tomcat 5.5, Tomcat 6.0 and WLS 10.0.
Comment 9 Konstantin Komissarchik CLA 2008-02-01 12:00:55 EST
Moral of the day... Unless you have a very good reason to use syncExec, use asyncExec instead.
Comment 10 Konstantin Komissarchik CLA 2008-02-04 10:40:24 EST
Released the second round of fixes into the 3.0 M5 code stream.