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

Bug 335956

Summary: Launching a JUnit test takes minutes writing platform.xml
Product: [Eclipse Project] PDE Reporter: Johannes Rieken <johannes_rieken>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P4 CC: curtis.windatt.public, daniel_megert
Version: 3.7Keywords: performance, polish
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Prototype to avoid creating the platform.xml
none
Fixed Patch none

Description Johannes Rieken CLA 2011-02-01 09:02:55 EST
Build Identifier: 3.7M4

When launching a JUnit test (or also an RCP) it takes a very long time to start. The progress monitor shows 'verifying launch attributes' for minutes. During that time memory consumption goes up. 

I did use jConsole to take a stack trace from the a active worker and found the following

Name: Worker-645
State: RUNNABLE
Total blocked: 529  Total waited: 993

Stack trace: 
org.eclipse.update.internal.configurator.FeatureParser.startElement(FeatureParser.java:87)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
org.eclipse.update.internal.configurator.FeatureParser.parse(FeatureParser.java:61)
org.eclipse.update.internal.configurator.SiteEntry.detectFeatures(SiteEntry.java:305)
org.eclipse.update.internal.configurator.SiteEntry.getFeatureEntries(SiteEntry.java:629)
org.eclipse.update.internal.configurator.SiteEntry.toXML(SiteEntry.java:696)
org.eclipse.update.internal.configurator.Configuration.toXML(Configuration.java:165)
org.eclipse.update.internal.configurator.PlatformConfiguration.saveAsXML(PlatformConfiguration.java:1227)
org.eclipse.update.internal.configurator.PlatformConfiguration.save(PlatformConfiguration.java:644)
   - locked org.eclipse.update.internal.configurator.PlatformConfiguration@ae24f7
org.eclipse.pde.internal.core.UpdateManagerHelper.createPlatformConfiguration(UpdateManagerHelper.java:88)
org.eclipse.pde.core.plugin.TargetPlatform.createPlatformConfiguration(TargetPlatform.java:208)
org.eclipse.pde.launching.JUnitLaunchConfigurationDelegate.collectExecutionArguments(JUnitLaunchConfigurationDelegate.java:143)
org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:141)
   - locked org.eclipse.pde.launching.JUnitLaunchConfigurationDelegate@87d976
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:925)
org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1129)
org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Reproducible: Always

Steps to Reproduce:
1. Have a workspace with many plugin
2. Have a p2 repository target platform
3. Have a small launch config (~200 plugins)
4. Launch and wait
Comment 1 Dani Megert CLA 2011-02-02 05:34:16 EST
Please take a look during M6. This bug makes using Eclipse a real pain.
Comment 2 Curtis Windatt CLA 2011-02-28 17:05:06 EST
We are spending a decent amount of time creating a configuration (platform.xml) for the update.configurator.  Most people are launching with the simple configurator (not update).  I think in those cases we don't need to generate the file.

Improving performance for the actual file generation would be more difficult.  We need to initialize all the features in the workspace so we can determine which ones are associated with the launch.  The actual writing of the file seems a little slow as well, not sure whether there are improvements we can make there.
Comment 3 Curtis Windatt CLA 2011-02-28 17:29:11 EST
Created attachment 190005 [details]
Prototype to avoid creating the platform.xml

This code moves where we create the platform.xml to inside the config.ini creation code.  This allows us more flexibility in determining what bundles are being launched (and therefore which configurator is being used).

Note that this patch does not create a platform.xml if BOTH simple configurator and update configurator are in the bundle list.  I'm not sure if this is an issue as the config.ini settings will be set to use only simple configurator.
Comment 4 Dani Megert CLA 2011-03-01 02:23:07 EST
>We are spending a decent amount of time creating a configuration (platform.xml)
>for the update.configurator. 
Is this work also done if I unchecked 'Clear the configuration area before launching'? Also, would it help to use an existing config.ini as template?
Comment 5 Dani Megert CLA 2011-03-01 03:23:55 EST
(In reply to comment #4)
> >We are spending a decent amount of time creating a configuration (platform.xml)
> >for the update.configurator. 
> Is this work also done if I unchecked 'Clear the configuration area before
> launching'?
According to Johannes, this doesn't help.
Comment 6 Curtis Windatt CLA 2011-03-03 17:16:13 EST
(In reply to comment #5)
> According to Johannes, this doesn't help.

Does the patch improve anything?

No changes planned for M6.
Comment 7 Dani Megert CLA 2011-03-14 06:00:05 EDT
(In reply to comment #6)
> (In reply to comment #5)
> > According to Johannes, this doesn't help.
> 
> Does the patch improve anything?
I don't think Johannes can use/apply the patch. Please connect with Johannes and provide a patched PDE plug-in, so that he can test it.
Comment 8 Johannes Rieken CLA 2011-03-23 09:27:33 EDT
Is there progress here? The provided patches couldn't be applied and I am worried that this will slip.
Comment 9 Curtis Windatt CLA 2011-03-23 11:15:49 EDT
Created attachment 191758 [details]
Fixed Patch

The previous patch was missing some changes.
Comment 10 Curtis Windatt CLA 2011-03-23 11:17:45 EDT
I have committed the patch to HEAD.  Tonight there will be a nightly build that Johannes can test on.
Comment 11 Curtis Windatt CLA 2011-03-24 17:09:14 EDT
Johannes, please test using:
http://download.eclipse.org/eclipse/downloads/drops/N20110323-2000/
Comment 12 Johannes Rieken CLA 2011-03-29 04:23:02 EDT
Using the nightly build shows an improvement. The very first launch was a bit slow (verifying launch attribute) but subsequent launches (also different launch configs) are fast now. 

Thanks
Comment 13 Curtis Windatt CLA 2011-03-29 09:49:36 EDT
This was released to the I build.  Closing as FIXED.