This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 543935 - JDT UI activator slows down startup of Eclipse
Summary: JDT UI activator slows down startup of Eclipse
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.11 M3   Edit
Assignee: Mark Hoffmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-29 07:41 EST by Andrey Loskutov CLA
Modified: 2019-05-20 05:18 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2019-01-29 07:41:01 EST
"Backporting" links to commit / gerrit as requested in bug 477579 comment 16.

JDT UI activator could do less things in startup():

https://git.eclipse.org/r/131872
https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=a73822ec12b13bd4ac73d1f502e5b8b6f7544fd7

Patch is already merged.
Comment 1 Andrey Loskutov CLA 2019-01-29 07:42:39 EST
Thanks Mark!
Comment 2 Lars Vogel CLA 2019-01-29 11:16:22 EST
Dani reported issues with this change in the PMC call. Dani, can you add details?
Comment 3 Dani Megert CLA 2019-01-29 11:41:35 EST
That changes causes this on my Windows 7 machine (4 cores, 16 GB RAM) with Java 11 using the first build (I20190125-1800) that has that change:

org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:88)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:76)
	at org.eclipse.jface.resource.ColorRegistry.<init>(ColorRegistry.java:118)
	at org.eclipse.jface.resource.ColorRegistry.<init>(ColorRegistry.java:96)
	at org.eclipse.jface.resource.JFaceResources.getColorRegistry(JFaceResources.java:191)
	at org.eclipse.jdt.ui.PreferenceConstants.initializeDeprecatedColorConstants(PreferenceConstants.java:4350)
	at org.eclipse.jdt.ui.PreferenceConstants.initializeDefaultValues(PreferenceConstants.java:4027)
	at org.eclipse.jdt.internal.ui.JavaUIPreferenceInitializer.initializeDefaultPreferences(JavaUIPreferenceInitializer.java:38)
	at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper$1.run(PreferenceServiceRegistryHelper.java:301)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.runInitializer(PreferenceServiceRegistryHelper.java:304)
	at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.applyRuntimeDefaults(PreferenceServiceRegistryHelper.java:134)
	at org.eclipse.core.internal.preferences.PreferencesService.applyRuntimeDefaults(PreferencesService.java:375)
	at org.eclipse.core.internal.preferences.DefaultPreferences.applyRuntimeDefaults(DefaultPreferences.java:225)
	at org.eclipse.core.internal.preferences.DefaultPreferences.load(DefaultPreferences.java:279)
	at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:370)
	at org.eclipse.core.internal.preferences.EclipsePreferences.internalNode(EclipsePreferences.java:623)
	at org.eclipse.core.internal.preferences.EclipsePreferences.node(EclipsePreferences.java:766)
	at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:41)
	at org.eclipse.core.runtime.preferences.DefaultScope.getNode(DefaultScope.java:77)
	at org.eclipse.jdt.internal.core.manipulation.MembersOrderPreferenceCacheCommon.install(MembersOrderPreferenceCacheCommon.java:112)
	at org.eclipse.jdt.internal.ui.preferences.MembersOrderPreferenceCache.install(MembersOrderPreferenceCache.java:38)
	at org.eclipse.jdt.internal.ui.JavaPlugin.createMemberOrderPreferenceCache(JavaPlugin.java:682)
	at org.osgi.util.promise.DeferredPromiseImpl$Submit.run(DeferredPromiseImpl.java:658)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)


And I see JDT UI preferences not being correctly set. For example the 'Build Path' page has no default values. As a result, creating a new Java project results in an error.

I will revert the change to see, whether it works again in tomorrow's build.
Comment 4 Dani Megert CLA 2019-01-29 11:43:10 EST
.
Comment 5 Andrey Loskutov CLA 2019-01-29 11:49:40 EST
(In reply to Dani Megert from comment #3)

Yep, the stack is direct result of the patch. If the code running before managed to init ColorRegistry, you will see no issues.

Sadly, is that in this concrete case htere is no need in the Display at all, only RGB values are needed by org.eclipse.jdt.ui.PreferenceConstants.initializeDeprecatedColorConstants(IPreferenceStore).
Comment 6 Dani Megert CLA 2019-01-29 11:52:35 EST
(In reply to Dani Megert from comment #3)
> I will revert the change to see, whether it works again in tomorrow's build.
Done.

I was already sceptical when I saw the bug report.
Comment 7 Dani Megert CLA 2019-01-30 03:26:08 EST
Reverting the change gets rid of the exception and creating new Java projects works again.

Tested with eclipse-SDK-I20190129-1800-win32-x86_64.
Comment 8 Dani Megert CLA 2019-02-01 10:57:43 EST
Besides that it badly broke things there are other issues with the proposed fix. Biggest issue is that it can cause a deadlock because getMemberOrderPreferenceCache() method blocks on promise.getValue. Depending on which thread (and its locks) calls getValue this can cause a deadlock.

Furthermore we do not have any performance measurements that would show a performance improvement.