Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 457718

Summary: OutOfMemoryError (Java Heap Space) when resolving bundles
Product: [Eclipse Project] Equinox Reporter: Thomas Watson <tjwatson>
Component: FrameworkAssignee: Thomas Watson <tjwatson>
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: hargrave, jean.barata, Martin.Halle, matthieu.helleboid, tjwatson
Version: 3.10.0 Luna   
Target Milestone: Luna SR2   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 457118    
Bug Blocks:    

Description Thomas Watson CLA 2015-01-16 11:57:56 EST
Cloning bug for considering a backport to Luna SR2
+++ This bug was initially created as a clone of Bug #457118 +++

Hello, 

When trying to start Capella (https://polarsys.org/capella/) on Luna we encounter OutOfMemoryError (please see the stacktrace below). This problem doesn't occur on Kepler and previous versions. It seems that there is too many blames objects generated in our case. After some research it seems to be related to https://issues.apache.org/jira/browse/FELIX-3465.

You can reproduce the problem with a Capella installation for Luna from here : https://hudson.polarsys.org/capella/job/capella-gerrit/81/artifact/result/publish/

!ENTRY org.eclipse.equinox.simpleconfigurator 4 0 2015-01-09 09:56:32.376
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.equinox.internal.simpleconfigurator.Activator.start() of bundle org.eclipse.equinox.simpleconfigurator.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
	at org.eclipse.osgi.container.Module.doStart(Module.java:571)
	at org.eclipse.osgi.container.Module.start(Module.java:439)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
	at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:242)
	at org.eclipse.osgi.container.Module.doStart(Module.java:571)
	at org.eclipse.osgi.container.Module.start(Module.java:439)
	at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:172)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
	at org.eclipse.osgi.launch.Equinox.start(Equinox.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:318)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: java.lang.OutOfMemoryError: Java heap space
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackage(ResolverImpl.java:943)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:865)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.mergeCandidatePackages(ResolverImpl.java:889)
	at org.apache.felix.resolver.ResolverImpl.calculatePackageSpaces(ResolverImpl.java:733)
	at org.apache.felix.resolver.ResolverImpl.calculatePackageSpaces(ResolverImpl.java:741)
	at org.apache.felix.resolver.ResolverImpl.calculatePackageSpaces(ResolverImpl.java:741)
	at org.apache.felix.resolver.ResolverImpl.calculatePackageSpaces(ResolverImpl.java:741)
	at org.apache.felix.resolver.ResolverImpl.calculatePackageSpaces(ResolverImpl.java:741)
	at org.apache.felix.resolver.ResolverImpl.calculatePackageSpaces(ResolverImpl.java:741)
	at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:251)
	at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolveSingleRevision(ModuleResolver.java:948)
	at org.eclipse.osgi.container.ModuleResolver$ResolveProcess.resolve(ModuleResolver.java:878)
	at org.eclipse.osgi.container.ModuleResolver.resolveDelta(ModuleResolver.java:111)
	at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:479)
	at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:437)
	at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:427)
	at org.eclipse.osgi.container.Module.start(Module.java:416)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412)
	at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:438)
	at org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111)
	at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191)
	at org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205)
Comment 1 Thomas Watson CLA 2015-01-16 12:00:41 EST
Only considering backporting the following commit that fixes the immediate issue in the Felix resolver:

http://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=e7db81bab4bce237fcafd3d624e56d183bbd6dae

The other changes in bug 457118 are performance enhancements in the Equinox code that calls the felix resolver.  These may not be appropriate for backporting.
Comment 2 Thomas Watson CLA 2015-01-16 12:20:26 EST
I got a gerrit review for this on the R4_4_maintenance branch:

https://git.eclipse.org/r/#/c/39783/

BJ, could you review?
Comment 3 BJ Hargrave CLA 2015-01-16 13:34:47 EST
(In reply to Thomas Watson from comment #2)
> I got a gerrit review for this on the R4_4_maintenance branch:
> 
> https://git.eclipse.org/r/#/c/39783/
> 
> BJ, could you review?

Reviewed.
Comment 4 Thomas Watson CLA 2015-01-16 16:40:06 EST
I released the fix as well as the test from master.
Comment 5 Martin Halle CLA 2015-04-07 04:26:25 EDT
I am badly struggling with this bug on Luna SR2.

I read the comments carefully and it seems there will be no easy Luna fix/update.

What can I do to have my project working again? A downgrade to Kepler is not possible for me. Any instructions of how to bypass this would be REALLY helpful!
Comment 6 Thomas Watson CLA 2015-04-07 13:56:56 EDT
(In reply to Martin Halle from comment #5)
> I am badly struggling with this bug on Luna SR2.
> 
> I read the comments carefully and it seems there will be no easy Luna
> fix/update.
> 
> What can I do to have my project working again? A downgrade to Kepler is not
> possible for me. Any instructions of how to bypass this would be REALLY
> helpful!

We will need some steps to reproduce.  The initial issue this defect was raised for was fixed in SR2.  It seems you have run into a separate issue.  It would be helpful if you could open a separate defect so we can track it separately.
Comment 7 Martin Halle CLA 2015-04-08 01:49:56 EDT
> We will need some steps to reproduce.  The initial issue this defect was
> raised for was fixed in SR2.  It seems you have run into a separate issue. 
> It would be helpful if you could open a separate defect so we can track it
> separately.
I think its resolved now, SR2 really fixed it. I tried a completely fresh Luna SR2 installation and this time I was able to start the project.

For the record:
1.) I did update Luna to SR2. Although I cleaned the installation by deleting the history I had both (org.eclipse.osgi_3.10.1.xxx and org.eclipse.osgi_3.10.2.xxx) packages installed - the one of SR1 and SR2. So there was the chance to pick the wrong one.
2.) For the my application under development to run I used a referenced (non-default) config.ini file. After I enabled the option to clear it (Run configurations -> tab "Configuration" -> "Clear the configuration file before launching") the application ran without trouble. Most likely the config.ini file referenced the SR1 packages (I didn't keep a copy, unfortunately).

I hope this helps others with the same problem - thank you, this thread helped me a lot to understand the problem.