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

Bug 513128

Summary: NPE on shutdown after error in start
Product: [Eclipse Project] Platform Reporter: Andrey Loskutov <loskutov>
Component: ResourcesAssignee: Andrey Loskutov <loskutov>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: 4.7 M6   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/92323
https://bugs.eclipse.org/bugs/show_bug.cgi?id=512052
https://git.eclipse.org/c/platform/eclipse.platform.resources.git/commit/?id=b96ceded5bee5307a7f8d6f3a0d4218de4b0530c
Whiteboard:

Description Andrey Loskutov CLA 2017-03-05 18:21:42 EST
Time to time my workbench fails to start (I have not understand yet why, but this is a different story). In this cases I see some NPE from resources plugin stop() code which can be easily prevented.

Here is a full log of such a broken startup:

Configuration location:
    file:/C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/
Configuration file:
    file:/C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/config.ini loaded
Install location:
    file:/C:/eclipse/SDK-I20170225/eclipse/
Framework located:
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi_3.12.0.v20170209-1741.jar
Loading extension: reference:file:C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi.compatibility.state_1.0.300.v20170118-1858.jar
	eclipse.properties not found
Framework classpath:
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi_3.12.0.v20170209-1741.jar
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi.compatibility.state_1.0.300.v20170118-1858.jar
Splash location:
    C:\eclipse\SDK-I20170225\eclipse\plugins\org.eclipse.platform_4.7.0.v20170225-2000\splash.bmp
Debug options:
    file:/C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/.options loaded
Time to load bundles: 16
Starting application: 1620
!SESSION 2017-03-06 00:14:46.445 -----------------------------------------------
eclipse.buildId=4.7.0.I20170225-2000
java.version=1.8.0_112
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data C:\workspaces\platform/../runtime-New_configuration(1) -dev file:C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/dev.properties -debug C:\workspaces\platform\.metadata\.plugins\org.eclipse.pde.core\New_configuration (1)/.options -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 4 0 2017-03-06 00:14:48.633
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.<init>(ModelServiceImpl.java:122)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:511)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)

!ENTRY org.eclipse.core.resources 4 0 2017-03-06 00:14:48.742
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Exception in org.eclipse.core.resources.ResourcesPlugin.stop() of bundle org.eclipse.core.resources.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:850)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:947)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:314)
	at org.eclipse.osgi.container.Module.doStop(Module.java:636)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1669)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1588)
	at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147)
	at org.eclipse.osgi.container.Module.doStop(Module.java:636)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at org.eclipse.core.resources.ResourcesPlugin.stop(ResourcesPlugin.java:486)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:830)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:823)
	... 13 more
Root exception:
java.lang.NullPointerException
	at org.eclipse.core.resources.ResourcesPlugin.stop(ResourcesPlugin.java:486)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:830)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$4.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.stop(BundleContextImpl.java:823)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.stopWorker0(EquinoxBundle.java:947)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.stopWorker(EquinoxBundle.java:314)
	at org.eclipse.osgi.container.Module.doStop(Module.java:636)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.decStartLevel(ModuleContainer.java:1669)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1588)
	at org.eclipse.osgi.container.SystemModule.stopWorker(SystemModule.java:270)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule.stopWorker(EquinoxBundle.java:147)
	at org.eclipse.osgi.container.Module.doStop(Module.java:636)
	at org.eclipse.osgi.container.Module.stop(Module.java:498)
	at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
	at java.lang.Thread.run(Thread.java:745)

!ENTRY org.eclipse.core.jobs 4 2 2017-03-06 00:14:48.820
!MESSAGE An internal error occurred during: "Initializing workspace.".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.core.internal.runtime.InternalPlatform.getLog(InternalPlatform.java:349)
	at org.eclipse.core.runtime.Plugin.getLog(Plugin.java:267)
	at org.eclipse.core.resources.ResourcesPlugin$1.run(ResourcesPlugin.java:533)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:182)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
An error has occurred. See the log file
C:\workspaces\runtime-New_configuration(1)\.metadata\.log.
Comment 1 Eclipse Genie CLA 2017-03-05 18:22:58 EST
New Gerrit change created: https://git.eclipse.org/r/92323
Comment 2 Andrey Loskutov CLA 2017-03-05 18:25:55 EST
(In reply to Eclipse Genie from comment #1)
> New Gerrit change created: https://git.eclipse.org/r/92323

This removes the NPE from Resources plugin, and the error (related to bug 512052) looks like:

Configuration location:
    file:/C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/
Configuration file:
    file:/C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/config.ini loaded
Install location:
    file:/C:/eclipse/SDK-I20170225/eclipse/
Framework located:
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi_3.12.0.v20170209-1741.jar
Loading extension: reference:file:C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi.compatibility.state_1.0.300.v20170118-1858.jar
	eclipse.properties not found
Framework classpath:
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi_3.12.0.v20170209-1741.jar
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/
    file:/C:/eclipse/SDK-I20170225/eclipse/plugins/org.eclipse.osgi.compatibility.state_1.0.300.v20170118-1858.jar
Splash location:
    C:\eclipse\SDK-I20170225\eclipse\plugins\org.eclipse.platform_4.7.0.v20170225-2000\splash.bmp
Debug options:
    file:/C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/.options loaded
Time to load bundles: 0
Starting application: 1698
!SESSION 2017-03-06 00:23:46.192 -----------------------------------------------
eclipse.buildId=4.7.0.I20170225-2000
java.version=1.8.0_112
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data C:\workspaces\platform/../runtime-New_configuration(1) -dev file:C:/workspaces/platform/.metadata/.plugins/org.eclipse.pde.core/New_configuration (1)/dev.properties -debug C:\workspaces\platform\.metadata\.plugins\org.eclipse.pde.core\New_configuration (1)/.options -os win32 -ws win32 -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 4 0 2017-03-06 00:23:48.666
!MESSAGE Application error
!STACK 1
java.lang.NullPointerException
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.<init>(ModelServiceImpl.java:122)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:511)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)

!ENTRY org.eclipse.core.jobs 4 2 2017-03-06 00:23:48.884
!MESSAGE An internal error occurred during: "Initializing workspace.".
!STACK 0
java.lang.NullPointerException
	at org.eclipse.core.internal.runtime.InternalPlatform.getLog(InternalPlatform.java:349)
	at org.eclipse.core.runtime.Plugin.getLog(Plugin.java:267)
	at org.eclipse.core.resources.ResourcesPlugin$1.run(ResourcesPlugin.java:536)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:182)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
An error has occurred. See the log file
C:\workspaces\runtime-New_configuration(1)\.metadata\.log.