This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 54624 - Unexpected JDWP Error + NullPointer exception when Debugging
Summary: Unexpected JDWP Error + NullPointer exception when Debugging
Status: CLOSED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-02-07 12:23 UTC by Lukas Hasik
Modified: 2010-04-29 09:21 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Hasik 2005-02-07 12:23:04 UTC
[Moved from internal bug database (#6217253).]

The following exception occured when debugging an
application with the nokia series 60 emulator when
a breakpoint was hit.  Afterwards, when i tried to
remove the breakpoint, i got the NPE i past after
this trace:

     [exec] com.sun.jdi.InternalException:
Unexpected JDWP Error: 41
     [exec]     at
com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.
java:47)
     [exec]     at
com.sun.tools.jdi.ConcreteMethodImpl.getBaseLocations(Concret
eMethodImpl.java:345)
     [exec]     at
com.sun.tools.jdi.ConcreteMethodImpl.getLocations(ConcreteMet
hodImpl.java:258)
     [exec]     at
com.sun.tools.jdi.ConcreteMethodImpl.locationsOfLine(Concrete
MethodImpl.java:116)
     [exec]     at
com.sun.tools.jdi.ReferenceTypeImpl.locationsOfLine(Reference
TypeImpl.java:793)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpoint
Impl.getLocation(LineBreakpointImpl.java:158)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpoint
Impl.classLoaded(LineBreakpointImpl.java:125)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.ClassBasedBrea
kpoint.checkLoadedClasses(ClassBasedBreakpoint.java:130)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpoint
Impl.setRequests(LineBreakpointImpl.java:117)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl
.update(BreakpointImpl.java:90)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl
.set(BreakpointImpl.java:71)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpoint
Impl.<init>(LineBreakpointImpl.java:69)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointsEng
ineListener.createBreakpointImpl(BreakpointsEngineListener.java:167)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointsEng
ineListener.breakpointAdded(BreakpointsEngineListener.java:119)
     [exec]     at
org.netbeans.api.debugger.DebuggerManager.fireBreakpointCreat
ed(DebuggerManager.java:608)
     [exec]     at
org.netbeans.api.debugger.DebuggerManager.addBreakpoint(Debug
gerManager.java:408)
     [exec]     at
org.netbeans.modules.debugger.jpda.ui.actions.ToggleBreakpoin
tActionProvider.doAction(ToggleBreakpointActionProvider.java:113)
     [exec]     at
org.netbeans.api.debugger.ActionsManager.doAction(ActionsMana
ger.java:113)
     [exec]     at
org.netbeans.modules.debugger.ui.actions.DebuggerAction.actio
nPerformed(DebuggerAction.java:45)
     [exec]     at
org.netbeans.editor.GlyphGutter$GutterMouseListener.mouseClic
ked(GlyphGutter.java:704)
     [exec]     at
java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster
.java:211)
     [exec]     at
java.awt.Component.processMouseEvent(Component.java:5103)
     [exec]     at
java.awt.Component.processEvent(Component.java:4897)
     [exec]     at
java.awt.Container.processEvent(Container.java:1569)
     [exec]     at
java.awt.Component.dispatchEventImpl(Component.java:3615)
     [exec]     at
java.awt.Container.dispatchEventImpl(Container.java:1627)
     [exec]     at
java.awt.Component.dispatchEvent(Component.java:3477)
     [exec]     at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.j
ava:3483)
     [exec]     at
java.awt.LightweightDispatcher.processMouseEvent(Container.ja
va:3207)
     [exec]     at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3
128)
     [exec]     at
java.awt.Container.dispatchEventImpl(Container.java:1613)
     [exec]     at
java.awt.Window.dispatchEventImpl(Window.java:1606)
     [exec]     at
java.awt.Component.dispatchEvent(Component.java:3477)
     [exec]     at
java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
     [exec] [catch] at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Eve
ntDispatchThread.java:201)
     [exec]     at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDisp
atchThread.java:151)
     [exec]     at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j
ava:145)
     [exec]     at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j
ava:137)
     [exec]     at
java.awt.EventDispatchThread.run(EventDispatchThread.java:100


     [exec] java.lang.NullPointerException
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl
.getEventRequestManager(BreakpointImpl.java:118)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.ClassBasedBrea
kpoint.setClassRequests(ClassBasedBreakpoint.java:64)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpoint
Impl.setRequests(LineBreakpointImpl.java:108)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl
.update(BreakpointImpl.java:90)
     [exec]     at
org.netbeans.modules.debugger.jpda.breakpoints.BreakpointImpl
.propertyChange(BreakpointImpl.java:95)
     [exec]     at
java.beans.PropertyChangeSupport.firePropertyChange(PropertyC
hangeSupport.java:252)
     [exec]     at
org.netbeans.api.debugger.Breakpoint.firePropertyChange(Break
point.java:127)
     [exec]     at
org.netbeans.api.debugger.Breakpoint.disposeOut(Breakpoint.ja
va:135)
     [exec]     at
org.netbeans.api.debugger.DebuggerManager.removeBreakpoint(De
buggerManager.java:421)
     [exec]     at
org.netbeans.modules.debugger.jpda.ui.actions.ToggleBreakpoin
tActionProvider.doAction(ToggleBreakpointActionProvider.java:90)
     [exec]     at
org.netbeans.api.debugger.ActionsManager.doAction(ActionsMana
ger.java:113)
     [exec]     at
org.netbeans.modules.debugger.ui.actions.DebuggerAction.actio
nPerformed(DebuggerAction.java:45)
     [exec]     at
org.netbeans.editor.GlyphGutter$GutterMouseListener.mouseClic
ked(GlyphGutter.java:704)
     [exec]     at
java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster
.java:211)
     [exec]     at
java.awt.Component.processMouseEvent(Component.java:5103)
     [exec]     at
java.awt.Component.processEvent(Component.java:4897)
     [exec]     at
java.awt.Container.processEvent(Container.java:1569)
     [exec]     at
java.awt.Component.dispatchEventImpl(Component.java:3615)
     [exec]     at
java.awt.Container.dispatchEventImpl(Container.java:1627)
     [exec]     at
java.awt.Component.dispatchEvent(Component.java:3477)
     [exec]     at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.j
ava:3483)
     [exec]     at
java.awt.LightweightDispatcher.processMouseEvent(Container.ja
va:3207)
     [exec]     at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3
128)
     [exec]     at
java.awt.Container.dispatchEventImpl(Container.java:1613)
     [exec]     at
java.awt.Window.dispatchEventImpl(Window.java:1606)
     [exec]     at
java.awt.Component.dispatchEvent(Component.java:3477)
     [exec]     at
java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
     [exec] [catch] at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(Eve
ntDispatchThread.java:201)
     [exec]     at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDisp
atchThread.java:151)
     [exec]     at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j
ava:145)
     [exec]     at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.j
ava:137)
     [exec]     at
java.awt.EventDispatchThread.run(EventDispatchThread.java:100
)

gcrawley@netbeans.com 2005-1-13 18:10:38 GMT


Unexpected JDWP Error: 41 has very likely been
caused by different set of sources in kvm and
kdwp, so it's the emulator's problem but NetBeans
debugger should not throw NPE. Please fix NPE and
if possible handle "JDWP Error: 41" more
gracefully. Also I'd suggest to add a text like -
"Probably problem of the VM/Emulator, please
report the problem to http://special_issue."
mryzl@netbeans.org 2005-2-04 15:07:09 GMT
Comment 1 Roman Ondruska 2005-03-29 08:45:42 UTC
We will look at it.
Comment 2 Martin Entlicher 2005-10-07 17:48:01 UTC
We report the JDI internal problems through ErrorManager now. It also assures
that the thread will not be interrupted because of that:

/cvs/debuggerjpda/src/org/netbeans/modules/debugger/jpda/breakpoints/LineBreakpointImpl.java,v
 <--  LineBreakpointImpl.java
new revision: 1.23; previous revision: 1.22

The NPE seems like a missing synchronization issue. We need to introduce some
lock, that will control the assignments to "virtualMachine" field in
JPDADebuggerImpl. E.g. SESSION_LOCK ?
Comment 3 Martin Entlicher 2005-11-03 14:34:56 UTC
This is a corner case. JDWP errors can occur on every call to JDI - it's not
possible to catch them everywhere. They just propagate into NetBeans like any
other errors/exceptions that happen in JVM. And JDWP errors does not have to be
thrown just on KVM.

It looks like the NPE does not occur in normal situations - thus decreasing to P5.
Comment 4 Martin Ryzl 2005-11-04 11:27:34 UTC
this is not a corner case and I don't agree with the priority change. JDI
Exceptions are part of contract and IDE should handle such exceptions in a
reasonable way not just throw the exception. I don't mean there should be a
conditional code everywhere but the IDE shouuld display a dialog explaining the
situation (problem on VM side) and ask user to report the problem to vendor or
netbeans team. Also it should not destabilize the whole debug session
(subsequent NPEs).
Comment 5 Lukas Hasik 2005-11-07 10:12:49 UTC
This isn't corner case for almost all j2me emulators.
It has to be solved on our side. Our users shouldn't be panished with exeptions
that aren't neccesary to show and even are part of contract.

-increasing priority to P2 - this issue is well described, well reproducible and
break debugging session and makes emulator unsusable. User need restart session
to be able to continue. 

Please re-evaluate, thank you.
Comment 6 _ kherink 2005-11-09 13:19:59 UTC
Since we will be running into similar problems with different emulators
frequently, the debugger should present these errors in a nicer way. I
understand that the NB debugger team can hardly be held accountable for faulty
VM implementations or JDI problems. It is however important to present the user
with a clearly understandable message such as "The debugging session was
abruptly interrupted, the issue is most likely Emulator related. Please report
to ..." We can assume that this is the case if the debugger is running with a
mobile project and the exception is thrown from JDI. How can this be accomplished?
Comment 7 Roman Ondruska 2005-11-15 14:30:08 UTC
Debugger & Mobility meeting conclusions:

JPDADebugger will handle this particular case (i.e. this stack) in some nicer
way (some dialog as discrabed above) for NB 5.0 provided this case is
reproducible. JPDADebugger will keep this issue open as P3 and try to find some
general solution for next release (possibly with support of ErrorManager).

Current status:
Neither I nor lhasik is able to reproduce this issue. Petre, Martine, please,
provide some hints. It would not be safe to write a work-around without
reproduction... 

 
Comment 8 Lukas Hasik 2005-11-16 18:49:28 UTC
I can easily reproduce it with additional informations from mryzl.
I receive this exception everytime when I hit breakpoint:

com.sun.jdi.InternalException: Unexpected JDWP Error: 41
	at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:47)
	at
com.sun.tools.jdi.VirtualMachineImpl.retrieveAllClasses1_4(VirtualMachineImpl.java:864)
	at
com.sun.tools.jdi.VirtualMachineImpl.retrieveAllClasses(VirtualMachineImpl.java:892)
	at com.sun.tools.jdi.VirtualMachineImpl.allClasses(VirtualMachineImpl.java:258)
	at com.sun.tools.jdi.ReferenceTypeImpl.nestedTypes(ReferenceTypeImpl.java:573)
	at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpointImpl.getLocations(LineBreakpointImpl.java:198)
	at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpointImpl.classLoaded(LineBreakpointImpl.java:126)
	at
org.netbeans.modules.debugger.jpda.breakpoints.ClassBasedBreakpoint.exec(ClassBasedBreakpoint.java:136)
	at
org.netbeans.modules.debugger.jpda.breakpoints.LineBreakpointImpl.exec(LineBreakpointImpl.java:154)
	at org.netbeans.modules.debugger.jpda.util.Operator$1.run(Operator.java:142)
[catch] at java.lang.Thread.run(Thread.java:595)
Comment 9 Roman Ondruska 2005-11-21 16:02:40 UTC
I am able to reproduce this issue.

STEPS:
------
1. Install WTK 2.2.
2. Unzip attached patch in the wtk installation directory (wtklib subdir).
3. Add -Doverride.kdp.classpath=<whatever> to emulator.bat (bin\emulator.bat in
wtk installation).
4. Set the wtk in project properties.
5. Run a MIDlet with breakpoint in debugger. 
Comment 10 Roman Ondruska 2005-11-22 14:33:42 UTC
Following message is displayed now: "An internal error occurred in the debugged
virtual machine. Debugging session may be unstable now, restart of debugger is
recommended."

It can be easily changed since it comes from bundle...
Comment 11 _ kherink 2006-12-11 03:23:57 UTC
This issue appears to be fixed in current version of NB (5.5).
Comment 12 Martin Entlicher 2006-12-14 10:01:02 UTC
Thanx. Setting the 5.5 target milestone.
Comment 13 Quality Engineering 2010-04-29 09:21:06 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.