Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342711 - [JFace] PreferenceConverter is not thread-safe
Summary: [JFace] PreferenceConverter is not thread-safe
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major with 5 votes (vote)
Target Milestone: 4.6 M3   Edit
Assignee: Stefan Xenos CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
: 172867 388044 417703 421386 (view as bug list)
Depends on:
Blocks: 409963
  Show dependency tree
 
Reported: 2011-04-13 09:26 EDT by Remy Suen CLA
Modified: 2015-12-09 11:47 EST (History)
16 users (show)

See Also:


Attachments
Proposed patch to fix the issue (1.71 KB, patch)
2013-12-18 12:15 EST, Camille Letavernier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2011-04-13 09:26:32 EDT
I got this in a 4.x inner today.

Since JDT UI got an error in its start(BundleContext) method, the whole startup sequence stopped and caused Eclipse to not start.

If you look at the initialization block of PreferenceConverter, it is very obviously not thread-safe.

Display display = Display.getCurrent();
if (display == null) {
  display = Display.getDefault ();
}
FONTDATA_ARRAY_DEFAULT_DEFAULT = display.getSystemFont().getFontData();

If there is no display on the current thread then the call to getSystemFont() is doomed to fail with an SWTException due to the invalid thread access. I wonder if we should be using a syncExec for this instead? Though syncExecs are quite hazardous so perhaps the fix should be in JDT or PDE instead?

!ENTRY org.eclipse.equinox.preferences 4 2 2011-04-13 08:48:02.906
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.equinox.preferences".
!STACK 0
java.lang.ExceptionInInitializerError
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
	at org.eclipse.jdt.ui.PreferenceConstants.initializeDefaultValues(PreferenceConstants.java:3716)
	at org.eclipse.jdt.internal.ui.JavaUIPreferenceInitializer.initializeDefaultPreferences(JavaUIPreferenceInitializer.java:38)
	at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper$1.run(PreferenceServiceRegistryHelper.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.runInitializer(PreferenceServiceRegistryHelper.java:284)
	at org.eclipse.core.internal.preferences.PreferenceServiceRegistryHelper.applyRuntimeDefaults(PreferenceServiceRegistryHelper.java:130)
	at org.eclipse.core.internal.preferences.PreferencesService.applyRuntimeDefaults(PreferencesService.java:368)
	at org.eclipse.core.internal.preferences.DefaultPreferences.applyRuntimeDefaults(DefaultPreferences.java:166)
	at org.eclipse.core.internal.preferences.DefaultPreferences.load(DefaultPreferences.java:237)
	at org.eclipse.core.internal.preferences.EclipsePreferences.create(EclipsePreferences.java:308)
	at org.eclipse.core.internal.preferences.EclipsePreferences.internalNode(EclipsePreferences.java:544)
	at org.eclipse.core.internal.preferences.EclipsePreferences.node(EclipsePreferences.java:670)
	at org.eclipse.core.internal.preferences.AbstractScope.getNode(AbstractScope.java:38)
	at org.eclipse.core.runtime.preferences.DefaultScope.getNode(DefaultScope.java:76)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.getDefaultPreferences(ScopedPreferenceStore.java:250)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.getPreferenceNodes(ScopedPreferenceStore.java:285)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.internalGet(ScopedPreferenceStore.java:475)
	at org.eclipse.ui.preferences.ScopedPreferenceStore.getBoolean(ScopedPreferenceStore.java:387)
	at org.eclipse.jdt.internal.ui.preferences.MembersOrderPreferenceCache.install(MembersOrderPreferenceCache.java:61)
	at org.eclipse.jdt.internal.ui.JavaPlugin.ensurePreferenceStoreBackwardsCompatibility(JavaPlugin.java:426)
	at org.eclipse.jdt.internal.ui.JavaPlugin.start(JavaPlugin.java:373)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(AccessController.java:251)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:460)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getExtension(ExtensionsRegistry.java:227)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.doGetDocumentSetupParticipants(ExtensionsRegistry.java:352)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getDocumentSetupParticipants(ExtensionsRegistry.java:374)
	at org.eclipse.core.internal.filebuffers.ResourceExtensionRegistry.getDocumentSetupParticipants(ResourceExtensionRegistry.java:119)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBufferManager.createEmptyDocument(ResourceTextFileBufferManager.java:144)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.initializeFileBufferContent(ResourceTextFileBuffer.java:285)
	at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java:245)
	at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java:112)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.createDocument(ErrorReporter.java:65)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.prepareTextBuildModel(BuildErrorReporter.java:1032)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.validate(BuildErrorReporter.java:164)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.validateContent(ErrorReporter.java:131)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateBuildProperties(ManifestConsistencyChecker.java:316)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateProject(ManifestConsistencyChecker.java:231)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.build(ManifestConsistencyChecker.java:157)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:717)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:228)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:284)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:340)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4277)
	at org.eclipse.swt.SWT.error(SWT.java:4192)
	at org.eclipse.swt.SWT.error(SWT.java:4163)
	at org.eclipse.swt.widgets.Display.error(Display.java:1258)
	at org.eclipse.swt.widgets.Display.checkDevice(Display.java:764)
	at org.eclipse.swt.widgets.Display.getSystemFont(Display.java:2459)
	at org.eclipse.jface.preference.PreferenceConverter.<clinit>(PreferenceConverter.java:85)
	at java.lang.J9VMInternals.initializeImpl(Native Method)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
	... 72 more

!ENTRY org.eclipse.osgi 4 0 2011-04-13 08:48:03.406
!MESSAGE An error occurred while automatically activating bundle org.eclipse.jdt.ui (6783).
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.jdt.internal.ui.JavaPlugin.start() of bundle org.eclipse.jdt.ui.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:460)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getExtension(ExtensionsRegistry.java:227)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.doGetDocumentSetupParticipants(ExtensionsRegistry.java:352)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getDocumentSetupParticipants(ExtensionsRegistry.java:374)
	at org.eclipse.core.internal.filebuffers.ResourceExtensionRegistry.getDocumentSetupParticipants(ResourceExtensionRegistry.java:119)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBufferManager.createEmptyDocument(ResourceTextFileBufferManager.java:144)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.initializeFileBufferContent(ResourceTextFileBuffer.java:285)
	at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java:245)
	at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java:112)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.createDocument(ErrorReporter.java:65)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.prepareTextBuildModel(BuildErrorReporter.java:1032)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.validate(BuildErrorReporter.java:164)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.validateContent(ErrorReporter.java:131)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateBuildProperties(ManifestConsistencyChecker.java:316)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateProject(ManifestConsistencyChecker.java:231)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.build(ManifestConsistencyChecker.java:157)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:717)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:228)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:284)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:340)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:283)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:308)
	at org.eclipse.jface.resource.JFaceResources.getFontRegistry(JFaceResources.java:342)
	at org.eclipse.jdt.internal.ui.JavaPlugin.ensurePreferenceStoreBackwardsCompatibility(JavaPlugin.java:448)
	at org.eclipse.jdt.internal.ui.JavaPlugin.start(JavaPlugin.java:373)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(AccessController.java:251)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	... 48 more
Root exception:
org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:283)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:308)
	at org.eclipse.jface.resource.JFaceResources.getFontRegistry(JFaceResources.java:342)
	at org.eclipse.jdt.internal.ui.JavaPlugin.ensurePreferenceStoreBackwardsCompatibility(JavaPlugin.java:448)
	at org.eclipse.jdt.internal.ui.JavaPlugin.start(JavaPlugin.java:373)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(AccessController.java:251)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:460)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getExtension(ExtensionsRegistry.java:227)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.doGetDocumentSetupParticipants(ExtensionsRegistry.java:352)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getDocumentSetupParticipants(ExtensionsRegistry.java:374)
	at org.eclipse.core.internal.filebuffers.ResourceExtensionRegistry.getDocumentSetupParticipants(ResourceExtensionRegistry.java:119)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBufferManager.createEmptyDocument(ResourceTextFileBufferManager.java:144)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.initializeFileBufferContent(ResourceTextFileBuffer.java:285)
	at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java:245)
	at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java:112)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.createDocument(ErrorReporter.java:65)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.prepareTextBuildModel(BuildErrorReporter.java:1032)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.validate(BuildErrorReporter.java:164)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.validateContent(ErrorReporter.java:131)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateBuildProperties(ManifestConsistencyChecker.java:316)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateProject(ManifestConsistencyChecker.java:231)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.build(ManifestConsistencyChecker.java:157)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:717)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:228)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:284)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:340)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

!ENTRY org.eclipse.equinox.registry 4 1 2011-04-13 08:48:03.406
!MESSAGE Plug-in org.eclipse.jdt.ui was unable to load class org.eclipse.jdt.internal.ui.propertiesfileeditor.PropertiesFileDocumentSetupParticipant.
!STACK 0
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.jdt.ui (6783).
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:122)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:460)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:618)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getExtension(ExtensionsRegistry.java:227)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.doGetDocumentSetupParticipants(ExtensionsRegistry.java:352)
	at org.eclipse.core.internal.filebuffers.ExtensionsRegistry.getDocumentSetupParticipants(ExtensionsRegistry.java:374)
	at org.eclipse.core.internal.filebuffers.ResourceExtensionRegistry.getDocumentSetupParticipants(ResourceExtensionRegistry.java:119)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBufferManager.createEmptyDocument(ResourceTextFileBufferManager.java:144)
	at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.initializeFileBufferContent(ResourceTextFileBuffer.java:285)
	at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.create(ResourceFileBuffer.java:245)
	at org.eclipse.core.internal.filebuffers.TextFileBufferManager.connect(TextFileBufferManager.java:112)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.createDocument(ErrorReporter.java:65)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.prepareTextBuildModel(BuildErrorReporter.java:1032)
	at org.eclipse.pde.internal.core.builders.BuildErrorReporter.validate(BuildErrorReporter.java:164)
	at org.eclipse.pde.internal.core.builders.ErrorReporter.validateContent(ErrorReporter.java:131)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateBuildProperties(ManifestConsistencyChecker.java:316)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateProject(ManifestConsistencyChecker.java:231)
	at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.build(ManifestConsistencyChecker.java:157)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:717)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:228)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:284)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:340)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.jdt.internal.ui.JavaPlugin.start() of bundle org.eclipse.jdt.ui.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:734)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
	at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
	at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
	... 42 more
Caused by: org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:283)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:308)
	at org.eclipse.jface.resource.JFaceResources.getFontRegistry(JFaceResources.java:342)
	at org.eclipse.jdt.internal.ui.JavaPlugin.ensurePreferenceStoreBackwardsCompatibility(JavaPlugin.java:448)
	at org.eclipse.jdt.internal.ui.JavaPlugin.start(JavaPlugin.java:373)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
	at java.security.AccessController.doPrivileged(AccessController.java:251)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
	... 48 more

!ENTRY org.eclipse.core.resources 4 2 2011-04-13 08:48:07.515
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.pde.internal.core.builders.SchemaErrorReporter.validateInclude(SchemaErrorReporter.java:280)
	at org.eclipse.pde.internal.core.builders.SchemaErrorReporter.validateContent(SchemaErrorReporter.java:106)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.compileFile(ExtensionPointSchemaBuilder.java:120)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.compileSchemasIn(ExtensionPointSchemaBuilder.java:183)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.compileSchemasIn(ExtensionPointSchemaBuilder.java:181)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.build(ExtensionPointSchemaBuilder.java:66)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:717)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:228)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:284)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:340)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

!ENTRY org.eclipse.osgi 4 0 2011-04-13 08:48:21.750
!MESSAGE Application error
!STACK 1
java.lang.NoClassDefFoundError: org.eclipse.jface.preference.PreferenceConverter (initialization failure)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:140)
	at org.eclipse.ui.internal.themes.ThemeElementHelper.installFont(ThemeElementHelper.java:103)
	at org.eclipse.ui.internal.themes.ThemeElementHelper.populateRegistry(ThemeElementHelper.java:59)
	at org.eclipse.ui.internal.Workbench$25.runWithException(Workbench.java:1492)
	at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4138)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3755)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2432)
	at org.eclipse.ui.internal.Workbench.access$3(Workbench.java:2340)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:540)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:522)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

!ENTRY org.eclipse.pde.api.tools 2 0 2011-04-13 08:48:22.843
!MESSAGE Failed to look up resolved fragment: org.eclipse.core.filesystem.win32.x86

!ENTRY org.eclipse.pde.api.tools 2 0 2011-04-13 08:48:23.140
!MESSAGE Failed to look up resolved fragment: org.eclipse.core.resources.win32.x86

!ENTRY org.eclipse.pde.api.tools 2 0 2011-04-13 08:48:33.015
!MESSAGE Failed to look up resolved fragment: org.eclipse.core.runtime.compatibility.registry

!ENTRY org.eclipse.core.resources 4 75 2011-04-13 08:48:34.718
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.pde.core 4 75 2011-04-13 08:48:34.718
!MESSAGE Errors running builder 'Extension Point Schema Builder' on project 'org.eclipse.ui'.
!STACK 0
java.lang.NullPointerException
	at org.eclipse.pde.internal.core.builders.SchemaErrorReporter.validateInclude(SchemaErrorReporter.java:280)
	at org.eclipse.pde.internal.core.builders.SchemaErrorReporter.validateContent(SchemaErrorReporter.java:106)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.compileFile(ExtensionPointSchemaBuilder.java:120)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.compileSchemasIn(ExtensionPointSchemaBuilder.java:183)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.compileSchemasIn(ExtensionPointSchemaBuilder.java:181)
	at org.eclipse.pde.internal.core.builders.ExtensionPointSchemaBuilder.build(ExtensionPointSchemaBuilder.java:66)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:717)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:191)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:228)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:281)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:284)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:340)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:363)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)more
Comment 1 Prakash Rangaraj CLA 2011-04-14 01:44:43 EDT
I think its best addressed at JFace level with syncExec().
Comment 2 Charles Bonneau CLA 2013-04-04 03:46:42 EDT
Hello,
What is the status of this bug ?
I have it quite often (but it is hard to reproduce it on purpose) and I really need to fix it or at least avoid it (for my customers).

Any advice on how to avoid it ?

Thanks,

BR,

Charles
Comment 3 Paul Webster CLA 2013-04-04 06:38:00 EDT
No one is looking at this at the moment.  If you want to submit a patch, see http://wiki.eclipse.org/Platform_UI/How_to_Contribute

PW
Comment 4 Paul Webster CLA 2013-09-26 09:41:01 EDT
*** Bug 417703 has been marked as a duplicate of this bug. ***
Comment 5 Andreas Muelder CLA 2013-09-26 09:56:37 EDT
Would be great if someone could have a look at this issue. 

This is really bad advertisement for the 4.x stream when the whole IDE crashes multiple times a day during plugin development.
Comment 6 Noopur Gupta CLA 2013-11-09 08:31:53 EST
*** Bug 421386 has been marked as a duplicate of this bug. ***
Comment 7 Sergey Prigogin CLA 2013-11-11 12:18:51 EST
This problem is pretty serious since it renders the Eclipse workspace unusable. The only available recovery option is to abandon the workspace and create a brand new one.
Comment 8 Paul Webster CLA 2013-11-15 13:59:43 EST
(In reply to Sergey Prigogin from comment #7)
> This problem is pretty serious since it renders the Eclipse workspace
> unusable. The only available recovery option is to abandon the workspace and
> create a brand new one.

Their are other workarounds.  The quickest one is to delete .metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi and restart your eclipse (your workspace is safe, just perspectives are reset).

The more surgical workaround is the remove all of your editors from that file.  All elements that have a contributionURI of bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor and all the element's children.

PW
Comment 9 Camille Letavernier CLA 2013-12-18 12:15:51 EST
Created attachment 238451 [details]
Proposed patch to fix the issue

This patch should fix the issue, by executing the PreferenceConverter static initialization in the Display thread.

I'm not sure how tests can be included in the current test suite, because the bug only occurs under specific class initialization conditions. The test would need to be executed in a separate Eclipse Application, to force the initialization of the PreferenceConverter in a different thread.

Basically, I've tested this patch with a new empty Java application, and using the PreferenceConverter from different thread (Non-UI and UI). But in a real Eclipse Application, the chances are high that the PreferenceConverter is already initialized when the test is called.
Comment 10 Paul Webster CLA 2013-12-18 16:23:25 EST
(In reply to Camille Letavernier from comment #9)
> Created attachment 238451 [details]
> Proposed patch to fix the issue

Hi Camille,

Could you please push your contribution to Gerrit?  http://www.vogella.com/articles/Gerrit/article.html#eclipsegerritcontribution

We can talk about it there.  Were you able to deploy the fix into the install that seemed to demonstrate the problem?  Did the problem disappear?

PW
Comment 11 Camille Letavernier CLA 2013-12-19 05:11:30 EST
Hi Paul,

I've pushed the change here: https://git.eclipse.org/r/20038

> Were you able to deploy the fix into the install that seemed to demonstrate the problem?  Did the problem disappear?

Actually, we've worked around the problem in our specific case. In most cases, the PreferenceConverter is initialized from the Display thread anyway, and it's hard to reproduce.

When I revert our local fix, I end up with a deadlock. It seems that the async runnable list is very long when starting Eclipse, and many plug-ins depend on the PreferenceConverter. And the PreferenceConverter itself waits for the Display thread to return the default font data.

So now, instead of an InvalidThreadAccess + ClassInitializationError, we have a deadlock :(

Basically, the deadlock seems to occur as soon as a Runnable is already waiting in the UI queue, and it depends on the PreferenceConverter initialization (Which itself waits for a slot in the UI queue).

The workaround doesn't introduce a deadlock, because we jump into the UI Thread before we initialize the PreferenceConverter. The PreferenceConverter class is never locked. With this patch, we jump to the UI thread during the class initialization, which means that the PreferenceConverter class is already locked.

I don't really see how this can be avoided.

Camille
Comment 12 Paul Webster CLA 2013-12-20 15:41:11 EST
Hi Camille,

(In reply to Camille Letavernier from comment #11)
> Hi Paul,
> 
> I've pushed the change here: https://git.eclipse.org/r/20038

Thanks for the patch.

I've looked through it and it has the same problems as similar problems as our attempts to fix Bug 296512

I'm not happy with the Display.getCurrent()/Display.getDefault() code (creating a display during initialization during classloading would cause eclipse to fail) but I realize that's already there.

But during workbench startup, the Display loop won't run any a/syncExec runnables.  If a bundle initialization thread is what causes this to run off the main UI thread, it will  block and can cause BundleStateExceptions then equinox times out those activators.

Just like Bug 296512, I don't think there's a lot we can do here that won't make it worse.

PW
Comment 13 Sergey Prigogin CLA 2013-12-20 17:41:08 EST
(In reply to Paul Webster from comment #12)
It seems that the solution should be not to make PreferenceConverter, or parts of it to run on the UI thread, but instead move the UI-dependent part of the PreferenceConverter to a separate method that can be executed later, when it is safe to call Display.asyncExec.
Comment 14 Paul Webster CLA 2013-12-20 19:38:00 EST
(In reply to Sergey Prigogin from comment #13)
> (In reply to Paul Webster from comment #12)
> It seems that the solution should be not to make PreferenceConverter, or
> parts of it to run on the UI thread, but instead move the UI-dependent part
> of the PreferenceConverter to a separate method that can be executed later,
> when it is safe to call Display.asyncExec.

It's problem is this is class initialization.  If I move this initialization out of the static {} I'll invalidate 2 constants so you can't be sure if your code uses them if they're available.  If they had been static methods it might have been easier, but the in the other bug they're methods and that hasn't worked out either.

PW
Comment 15 Sergey Prigogin CLA 2013-12-20 19:46:44 EST
(In reply to Paul Webster from comment #14)
Since the damage caused by Eclipse failing on startup is so high, it warrants a drastic solution of deprecating the problematic constants and leaving them only for binary compatibility with some hardcoded values.
Comment 16 Paul Webster CLA 2013-12-20 19:53:44 EST
(In reply to Sergey Prigogin from comment #15)
> (In reply to Paul Webster from comment #14)
> Since the damage caused by Eclipse failing on startup is so high, it
> warrants a drastic solution of deprecating the problematic constants and
> leaving them only for binary compatibility with some hardcoded values.

That's what I'm thinking.  What if we hard-code some default FontData in the static initialization and leave an asyncExec to fill them in with the system font at the end of initialization.

But the downside is that can lead to unknown font being used for something initialized to early.  I guess that could go as a warning on the javadoc.

PW
Comment 17 Sergey Prigogin CLA 2013-12-20 20:56:22 EST
(In reply to Paul Webster from comment #16)
I agree with this proposal as long as the constants are deprecated to discourage their use.
Comment 18 Eclipse Genie CLA 2015-10-12 22:36:43 EDT
New Gerrit change created: https://git.eclipse.org/r/58043
Comment 19 Stefan Xenos CLA 2015-10-12 22:37:52 EDT
I came across this while triaging for dupes of bug 479475 and thought I'd contribute a fix, since it was so easy.
Comment 20 Stefan Xenos CLA 2015-10-12 22:52:35 EDT
*** Bug 388044 has been marked as a duplicate of this bug. ***
Comment 21 Stefan Xenos CLA 2015-10-12 23:04:43 EDT
*** Bug 172867 has been marked as a duplicate of this bug. ***
Comment 23 Stefan Xenos CLA 2015-10-12 23:10:56 EDT
Patch submitted. That should do the trick.