eclipse-pde / eclipse.pde

Eclipse Public License 2.0
28 stars 79 forks source link

NPE in PDEModelUtility.java:415 #1404

Open jukzi opened 2 months ago

jukzi commented 2 months ago
eclipse.buildId=4.34.0.I20240908-1800
java.version=21.0.2
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=de_DE
Command-line arguments:  -os win32 -ws win32 -arch x86_64

org.eclipse.ui
Error
Tue Sep 10 11:47:22 CEST 2024
Unhandled event loop exception

java.lang.NullPointerException: Cannot invoke "org.eclipse.pde.internal.ui.editor.context.InputContextManager.findContext(org.eclipse.core.resources.IResource)" because the return value of "org.eclipse.pde.internal.ui.editor.PDEFormEditor.getContextManager()" is null
    at org.eclipse.pde.internal.ui.util.PDEModelUtility.lambda$1(PDEModelUtility.java:415)
    at org.eclipse.ui.internal.PendingSyncExec.run(PendingSyncExec.java:68)
    at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:166)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4099)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3715)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:639)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:546)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1481)

As far as i remember the last action i did before the error was logged: Close like 90 editors by "Close Others" from the editor tab context menu.

As far as i see in the code org.eclipse.pde.internal.ui.editor.PDEFormEditor.dispose() is the only thing that makes contextManager = null.

opcoach commented 1 month ago

May be we could consider this issue as a Good First issue

slvo-loading commented 1 month ago

I'm working on this

HannesWell commented 1 month ago

I'm working on this

Great. You are one of the students from CodeDays, aren't you?

Much success on this task and don't hesitate to ask for help if you need any.

slvo-loading commented 2 weeks ago

Hi @jukzi ,

I tried to reproduce the issue in both the most recent public release (2024.09) of Eclipse and in the development version. I opened 90 Eclipse project files and used “Close Others”. I didn’t get any kind of error. I also let it sit for a bit, and still didn’t get an error.

Based on this, I’m wondering if this is still a problem for you or if it was fixed somehow?

If this is still an issue for you, could you give us more details such as log files, specifics on the type of editors you opened, etc.

I’d be especially interested in a complete minimal reproduction.

Thank you 👍

jukzi commented 1 week ago

I don't have more information then already provided. Such race conditions may be hard to reproduce.

LudoLogical commented 1 week ago

Hi all, I'm one of the Consulting Software Engineers on the general mentor team at CodeDay Labs/Init and have worked with @slvo-loading extensively on this issue. Given that @jukzi (thank you for the quick response on such an old issue, by the way!) cannot easily identify a minimal set of reproduction steps for this bug and believes it might be a "race condition," I would like to suggest that the good first issue tag be removed so as not to potentially mislead future first-time contributors. It might also be worth putting work on this on the backburner until more information comes to light concerning the potential root cause and the possibility space can be collapsed somewhat. Cheers!

jukzi commented 1 week ago

hint: this type of errors can often be solved by thinking about what could have gone wrong. An intermediate step may involve adding a check at an earlier point of time or extending errormessage/logging to get missing information.