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

Bug 310711

Summary: NPE getting stackframe while quickly stepping
Product: [WebTools] JSDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: Simon Kaegi <simon_kaegi>
Status: RESOLVED FIXED QA Contact: Simon Kaegi <simon_kaegi>
Severity: normal    
Priority: P3 CC: thatnitind
Version: 3.2   
Target Milestone: 3.2 M7   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 308789    
Attachments:
Description Flags
preliminary patch none

Description Michael Rennie CLA 2010-04-27 16:18:41 EDT
code from HEAD

while stepping very quickly I managed to get the following NPE, sorry no steps other than holding down the F5 button for a while:

java.lang.NullPointerException
	at org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread.getStackFrames(JavaScriptThread.java:335)
	at org.eclipse.wst.jsdt.debug.internal.core.model.JavaScriptThread.getTopStackFrame(JavaScriptThread.java:371)
	at org.eclipse.debug.internal.ui.DelegatingModelPresentation.getInstructionPointerAnnotation(DelegatingModelPresentation.java:396)
	at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.display(SourceLookupFacility.java:244)
	at org.eclipse.debug.ui.DebugUITools.displaySource(DebugUITools.java:792)
	at org.eclipse.debug.internal.ui.elements.adapters.StackFrameSourceDisplayAdapter$SourceDisplayJob.runInUIThread(StackFrameSourceDisplayAdapter.java:155)
	at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:95)
	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:3515)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3162)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2601)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2565)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2399)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:669)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:662)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	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:369)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Comment 1 Simon Kaegi CLA 2010-04-28 10:45:45 EDT
Created attachment 166326 [details]
preliminary patch

This can occur because the getFrames call is not synchronized and someone can come along and call clearframes and leave us in an inconsistent state. I have applied this preliminary patch but am leaving this bug open until we're happy with everything.
Comment 2 Simon Kaegi CLA 2010-04-28 22:47:52 EDT
Fixed in HEAD.