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 255779 - NullPointerException at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl.makeThreadCurrent
Summary: NullPointerException at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImp...
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal (vote)
Assignee: henk89
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-07 15:34 UTC by Vladimir Kvashin
Modified: 2015-12-23 14:37 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 220416


Attachments
stacktrace (1.09 KB, text/plain)
2015-10-07 15:34 UTC, Vladimir Kvashin
Details
Possible fix (1.46 KB, patch)
2015-10-08 10:02 UTC, Vladimir Kvashin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Kvashin 2015-10-07 15:34:15 UTC
Build: NetBeans IDE Dev (Build 201510060002)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.51-b03, Java(TM) SE Runtime Environment, 1.8.0_51-b16
OS: Linux

User Comments:
vkvashin: I tried to do mixed (java and C/C++) debugging
Unfortunately I don't remember exact details




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl.makeThreadCurrent(GdbDebuggerImpl.java:1860)
   at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl$21.onDone(GdbDebuggerImpl.java:2320)
   at org.netbeans.modules.cnd.debugger.gdb2.mi.MICommandManager.dispatch(MICommandManager.java:194)
   at org.netbeans.modules.cnd.debugger.gdb2.mi.MIProxy.dispatch(MIProxy.java:188)
   at org.netbeans.modules.cnd.debugger.gdb2.Gdb$MyMIProxy.dispatch(Gdb.java:697)
   at org.netbeans.modules.cnd.debugger.gdb2.mi.MIProxy.result(MIProxy.java:193)
Comment 1 Vladimir Kvashin 2015-10-07 15:34:16 UTC
Created attachment 156593 [details]
stacktrace
Comment 2 Vladimir Kvashin 2015-10-08 09:59:17 UTC
I also noiticed the following messages in console - I don't know whether they are related with the issue or not:

WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 53-stack-list-arguments 1 --thread 27 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 54-stack-list-arguments 1 --thread 26 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 55-stack-list-arguments 1 --thread 25 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 56-stack-list-arguments 1 --thread 24 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 57-stack-list-arguments 1 --thread 23 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 58-stack-list-arguments 1 --thread 22 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 59-stack-list-arguments 1 --thread 21 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 60-stack-list-arguments 1 --thread 20 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 61-stack-list-arguments 1 --thread 19 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 62-stack-list-arguments 1 --thread 18 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 63-stack-list-arguments 1 --thread 17 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 64-stack-list-arguments 1 --thread 16 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 65-stack-list-arguments 1 --thread 15 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 66-stack-list-arguments 1 --thread 14 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 67-stack-list-arguments 1 --thread 13 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 68-stack-list-arguments 1 --thread 12 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 69-stack-list-arguments 1 --thread 11 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 70-stack-list-arguments 1 --thread 10 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 71-stack-list-arguments 1 --thread 9 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 72-stack-list-arguments 1 --thread 8 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 73-stack-list-arguments 1 --thread 7 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 74-stack-list-arguments 1 --thread 6 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 75-stack-list-arguments 1 --thread 5 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 76-stack-list-arguments 1 --thread 4 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 77-stack-list-arguments 1 --thread 3 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 78-stack-list-arguments 1 --thread 2 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 79-stack-list-arguments 1 --thread 1 to gdb while program is running
WARNING [class org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl]: Sending 80-stack-list-frames --thread 1 to gdb while program is running
Comment 3 Vladimir Kvashin 2015-10-08 10:02:59 UTC
Created attachment 156616 [details]
Possible fix

The code in GdbDebuggerImpl.requestThreadsWithStacks() contains latent NPE: if the thread is not found by IDE, then NPE is guaranteed. The possible fix could be as attached - but I have no idea, what are further consequences and thus correct error processing.
Comment 4 Vladimir Kvashin 2015-10-23 12:03:29 UTC
I faced it again when trying to debug a relatively simple (although multy-threaded) fs_server program.
Comment 5 Vladimir Kvashin 2015-12-03 10:26:10 UTC
I see lots of such exceptions in the log attached to issue 256891

A while ago I attached the proposed fix, which is not ideal probably, but at least eliminates NPE. It should be probably enhanced with a brief error message (in IDE status bar for example)
Comment 6 henk89 2015-12-11 13:37:01 UTC
This fix just helps a user avoid the exception. I need a gdb log to get better understanding why the threadlist is empty.


https://enum.ru.oracle.com/hg/release81/rev/fe7746ed691b
https://enum.ru.oracle.com/hg/release81/rev/c3b32ff1efa4
Comment 7 Quality Engineering 2015-12-16 02:30:42 UTC
Integrated into 'main-silver', will be available in build *201512160002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/cdae712fa8b7
User: Nikolay Koldunov <henk89@netbeans.org>
Log: Fixed #255779 - NullPointerException at org.netbeans.modules.cnd.debugger.gdb2.GdbDebuggerImpl.makeThreadCurrent
(transplanted from fe7746ed691b9bc12acd67b5746058e92b1a7b59)
Comment 8 Alexander Pepin 2015-12-23 14:37:21 UTC
Cannot reproduce the bug in build 20121215.