Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 275572 - PDE 'Set Target Platform' hangs when several javax.xml related bundles are present
Summary: PDE 'Set Target Platform' hangs when several javax.xml related bundles are pr...
Status: CLOSED DUPLICATE of bug 261849
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.4.2   Edit
Hardware: PC Linux
: P3 critical with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: equinox.framework-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 216934
Blocks:
  Show dependency tree
 
Reported: 2009-05-10 17:26 EDT by Stephen Evanchik CLA
Modified: 2010-02-05 17:30 EST (History)
4 users (show)

See Also:


Attachments
bnd output of org.apache.servicemix.specs.jaxb-api-2.1-1.3.0.jar (6.16 KB, text/plain)
2009-05-10 17:26 EDT, Stephen Evanchik CLA
no flags Details
bnd output of org.apache.servicemix.specs.jaxp-api-1.4-1.3.0.jar (9.53 KB, text/plain)
2009-05-10 17:26 EDT, Stephen Evanchik CLA
no flags Details
bnd output of org.apache.servicemix.specs.jaxws-api-2.1-1.3.0.jar (5.56 KB, text/plain)
2009-05-10 17:27 EDT, Stephen Evanchik CLA
no flags Details
List of all plugins being loaded in the target platform (9.67 KB, text/plain)
2009-05-11 13:02 EDT, Stephen Evanchik CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Evanchik CLA 2009-05-10 17:26:06 EDT
Created attachment 135077 [details]
bnd output of org.apache.servicemix.specs.jaxb-api-2.1-1.3.0.jar

Eclipse Version: 3.4.2
Build id: M20090211-1700

java version "1.6.0_0"
IcedTea6 1.4 (fedora-15.b14.fc10-x86_64) Runtime Environment (build 1.6.0_0-b14)
OpenJDK 64-Bit Server VM (build 14.0-b08, mixed mode)

I have a Target Runtime Definition with Equinox 3.4.2 plus > 160 other bundles installed. When I add the following bundles:

org.apache.servicemix.specs.jaxb-api-2.1-1.3.0.jar (javax.xml.bind.*)
org.apache.servicemix.specs.jaxp-api-1.4-1.3.0.jar (javax.xml.*)
org.apache.servicemix.specs.jaxws-api-2.1-1.3.0.jar (javax.xml.ws.*)

and click the 'Set as Target Platform' link in the Target Platform Definition editor PDE hangs during the 'Resetting Target Platform' phase.

These bundles can be found in the Apache ServiceMix 4 download. I can attach if requested to do so.

Steps to reproduce:

 1. Download Equinox 3.4.2 SDK and unzip in <equinox_home>
 2. Download Apache ServiceMix 4 and copy <smix4_base>/system/**/*.jar to <equinox_home>/plugins
 3. Move the 3 mentioned files out of <equinox_home>/plugins 
 4. Define a new Target Platform with <equinox_home> as the 'Location'
 5. Click 'Set as Target Platform'
 6. The Target Platform is successfully reset
 7. Move the 3 mentioned files in to <equinox_home>/plugins
 8. Click 'Set as Target Platform'
 9. CPU is 100%, UI is non-responsive

There is no output in the console log. I have tried setting the Execution Environment to JavaSE-1.6 and JavaSE-1.5 but the behavior is the same for both.

I have attached the bnd print output for the 3 bundles.
Comment 1 Stephen Evanchik CLA 2009-05-10 17:26:46 EDT
Created attachment 135078 [details]
bnd output of org.apache.servicemix.specs.jaxp-api-1.4-1.3.0.jar
Comment 2 Stephen Evanchik CLA 2009-05-10 17:27:16 EDT
Created attachment 135079 [details]
bnd output of org.apache.servicemix.specs.jaxws-api-2.1-1.3.0.jar
Comment 3 Stephen Evanchik CLA 2009-05-10 17:31:50 EDT
I have since tried several combinations of Target Platform bundles:

 1. WORKING: Equinox 3.4.2 SDK +
     org.apache.servicemix.specs.jaxb-api-2.1-1.3.0.jar,
     org.apache.servicemix.specs.jaxp-api-1.4-1.3.0.jar, 
     org.apache.servicemix.specs.jaxws-api-2.1-1.3.0.jar

It appears that the hang only occurs if there is something that uses the packages exported from these bundles.
Comment 4 Olivier Thomann CLA 2009-05-10 19:44:21 EDT
Moving to PDE/UI
Comment 5 Stephen Evanchik CLA 2009-05-10 20:23:45 EDT
I created a unit test to see what is going on during execution. The method call that sends PDE in to a seemingly infinite loop is:

org.eclipse.osgi.internal.module.ResolverImpl.resolveBundles(ResolverBundle[], Dictionary[], ArrayList)

I suspect there is an infinite recursion while checking 'uses' (you can see this from the stack trace). The interesting thing is that I can get all of these bundles to work outside of PDE and run Apache ServiceMix using Equinox.

Here is a stack trace when I set a breakpoint in ResolverImpl. It seems that resolveBundles0 is being recursively called and never terminates:


Thread [main] (Suspended (breakpoint at line 622 in ResolverImpl))	
	ResolverImpl.findBestCombination(ResolverBundle[], ResolverConstraint[][], int[], ArrayList) line: 622	
	ResolverImpl.findBestCombination(ResolverBundle[]) line: 594	
	ResolverImpl.checkUsesConstraints(ResolverBundle[], Dictionary[], ArrayList) line: 539	
	ResolverImpl.resolveBundles0(ResolverBundle[], Dictionary[], ArrayList) line: 535	
	ResolverImpl.checkUsesConstraints(ResolverBundle[], Dictionary[], ArrayList) line: 573	
	ResolverImpl.resolveBundles0(ResolverBundle[], Dictionary[], ArrayList) line: 535	
	ResolverImpl.checkUsesConstraints(ResolverBundle[], Dictionary[], ArrayList) line: 573	
	ResolverImpl.resolveBundles0(ResolverBundle[], Dictionary[], ArrayList) line: 535	
	ResolverImpl.checkUsesConstraints(ResolverBundle[], Dictionary[], ArrayList) line: 573	
	ResolverImpl.resolveBundles0(ResolverBundle[], Dictionary[], ArrayList) line: 535	
	ResolverImpl.resolveBundles(ResolverBundle[], Dictionary[], ArrayList) line: 501	
	ResolverImpl.resolve(BundleDescription[], Dictionary[]) line: 388	
	UserState(StateImpl).resolve(boolean, BundleDescription[]) line: 428	
	UserState(StateImpl).resolve(boolean) line: 488	
	PDEState(MinimalState).internalResolveState(boolean) line: 206	
	PDEState(MinimalState).resolveState(boolean) line: 201	
	PDEState.readTargetState(URL[], IProgressMonitor) line: 121	
	PDEState.<init>(URL[], URL[], boolean, IProgressMonitor) line: 98	
	PDEState.<init>(URL[], boolean, IProgressMonitor) line: 90	
	LoadTargetOperation.handleReload(String, List, Preferences, IProgressMonitor) line: 234	
	LoadTargetOperation.loadPlugins(Preferences, IProgressMonitor) line: 147	
	LoadTargetOperation.run(IProgressMonitor) line: 53	
	LoadTargetDefinitionTest.testLoadTarget() line: 36	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 616	
	LoadTargetDefinitionTest(TestCase).runTest() line: 164	
	LoadTargetDefinitionTest(TestCase).runBare() line: 130	
	TestResult$1.protect() line: 106	
	TestResult.runProtected(Test, Protectable) line: 124	
	TestResult.run(TestCase) line: 109	
	LoadTargetDefinitionTest(TestCase).run(TestResult) line: 120	
	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: 62	
	UITestApplication$1.run() line: 114	
	RunnableLock.run() line: 35	
	UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 133	
	Display.runAsyncMessages(boolean) line: 3378	
	Display.readAndDispatch() line: 3036	
	Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2384	
	Workbench.runUI() line: 2348	
	Workbench.access$4(Workbench) line: 2200	
	Workbench$5.run() line: 495	
	Realm.runWithDefault(Realm, Runnable) line: 288	
	Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 490	
	PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149	
	IDEApplication.start(IApplicationContext) line: 113	
	UITestApplication.start(IApplicationContext) line: 46	
	EclipseAppHandle.run(Object) line: 193	
	EclipseAppLauncher.runApplication(Object) line: 110	
	EclipseAppLauncher.start(Object) line: 79	
	EclipseStarter.run(Object) line: 386	
	EclipseStarter.run(String[], Runnable) line: 179	
	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
	Method.invoke(Object, Object...) line: 616	
	Main.invokeFramework(String[], URL[]) line: 549	
	Main.basicRun(String[]) line: 504	
	Main.run(String[]) line: 1236	
	Main.main(String[]) line: 1212	

Comment 6 Olivier Thomann CLA 2009-05-10 20:30:29 EDT
Move to Equinox/Framework
Comment 7 Stephen Evanchik CLA 2009-05-10 20:41:52 EDT
Ok, last update. I left the unit test running (I can provide it if necessary all it does it call LoadTargetOperation.run()) and it did succeed.

The test ran for 1,032.159 seconds which is about 17 minutes. That is far too long for a test/dev cycle.

Is there a way for me to narrow down which combination of bundles is causing this search to take so long?
Comment 8 Stephen Evanchik CLA 2009-05-10 22:27:38 EDT
After tracing through the code I found: osgi.resolver.usesMode which I set to ignore in my PDE JUnit test launch configuration. This fixes the problem in that the unit test takes 4.39 seconds but I'm not sure what other issues this property is going to introduce.

I also don't know how to set this so that Eclipse PDE uses it when 'Set as Target Platform' is clicked or the Target Platform preferences panel is updated.  

Comment 9 Chris Aniszczyk CLA 2009-05-11 11:51:02 EDT
Tom, didn't you fix an issue around 'uses' recently? Wondering if this is a dupe.
Comment 10 Thomas Watson CLA 2009-05-11 12:12:31 EDT
(In reply to comment #9)
> Tom, didn't you fix an issue around 'uses' recently? Wondering if this is a
> dupe.
> 

No, not recently.  Will have to investigate, but we are kinda stuck until we can really focus on a true "uses" clause solution.  This wont happen in 3.5.
Comment 11 Chris Aniszczyk CLA 2009-05-11 12:14:06 EDT
I'm a bit perplexed by 'uses' 

Does any framework have a good solution for this problem? If not, we should have a general recommendation of people to not have 'uses' clauses in their manifests.
Comment 12 Thomas Watson CLA 2009-05-11 12:31:38 EDT
I tried this on 3.5.  I'm not seeing anything near 17 minutes but it could be some ordering thing.  I am also surprised by 17 minutes since we should timeout way before that (after 90 seconds).  That timeout is implemented in 3.4.0.
Comment 13 Stephen Evanchik CLA 2009-05-11 13:01:22 EDT
(In reply to comment #12)
> I tried this on 3.5.  I'm not seeing anything near 17 minutes but it could be
> some ordering thing.  I am also surprised by 17 minutes since we should timeout
> way before that (after 90 seconds).  That timeout is implemented in 3.4.0.
> 

I just duplicated this on my Mac with Eclipse 3.4.2:

 1. Download eclipse-equinox-SDK-3.4.2.zip
 2. Download apache-servicemix-4.0.0.tar.gz
 3. Unpack both
 4. cd eclipse/plugins
 5. cp `find <path to servicemix>/system -name "*.jar" | xargs` .
 6. Window -> Preferences -> Target Platform
 7. Browse to the unpacked eclipse/plugins
 8. Click Ok
 9. 'Reading Target Platform...' has been going for 8 minutes now.
Comment 14 Stephen Evanchik CLA 2009-05-11 13:02:31 EDT
Created attachment 135174 [details]
List of all plugins being loaded in the target platform
Comment 15 Stephen Evanchik CLA 2009-05-11 13:05:13 EDT
(In reply to comment #11)
> I'm a bit perplexed by 'uses' 
> 
> Does any framework have a good solution for this problem? If not, we should
> have a general recommendation of people to not have 'uses' clauses in their
> manifests.
> 

Could this be solved by having a PDE preference that sets osgi.resolver.usesMode ? I don't think it is going to be feasible to have people avoid 'uses' clauses; especially in light of bnd generating them by default.
Comment 16 Stephen Evanchik CLA 2009-05-11 13:54:39 EDT
(In reply to comment #12)
> I tried this on 3.5.  I'm not seeing anything near 17 minutes but it could be
> some ordering thing.  I am also surprised by 17 minutes since we should timeout
> way before that (after 90 seconds).  That timeout is implemented in 3.4.0.
> 

I just tried this on a vanilla 3.5M7 and 3.4.2 SR1 Mac OS X:

 1. 3.5M7 works perfectly; the new target platform management system is nice (new, empty workspace). 
 2. Vanilla 3.4.2 (eclipse-rcp-ganymede-SR1-macosx-carbon.tar.gz) still has the issue (new, empty workspace)
 3. 3.4.2 + all my plugins but with a new, empty workspace still has the issue. 
Comment 17 Thomas Watson CLA 2009-05-12 10:03:37 EDT
> Tom, didn't you fix an issue around 'uses' recently? Wondering if this is a
> dupe.
> 

This could be related to bug 272561(In reply to comment #9)

Do you see anything new errors in your log file when you reproduce on 3.4.x?
Comment 18 Stephen Evanchik CLA 2009-05-12 10:18:58 EDT
(In reply to comment #17)
> > Tom, didn't you fix an issue around 'uses' recently? Wondering if this is a
> > dupe.
> > 
> 
> This could be related to bug 272561(In reply to comment #9)
> 
> Do you see anything new errors in your log file when you reproduce on 3.4.x?
> 

I am in the habit of running Eclipse from the commandline via ./eclipse -consolelog .. I didn't see the StackOverflow there or in the .log file of my workspace.
Comment 19 Thomas Watson CLA 2010-02-05 17:30:11 EST

*** This bug has been marked as a duplicate of bug 261849 ***