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 203164 - Profiling CPU doesn't work when Profiling roots include libraries
Summary: Profiling CPU doesn't work when Profiling roots include libraries
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Ide (show other bugs)
Version: 7.0.1
Hardware: PC All
: P2 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-05 16:04 UTC by Petr Cyhelsky
Modified: 2012-06-05 06:05 UTC (History)
1 user (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 Petr Cyhelsky 2011-10-05 16:04:50 UTC
steps: invoke profiling -> analyze performance -> profile application -> edit profiling roots -> check the whole application -> the session ends "successfully" :) just after finishing instrumentation
Comment 1 J Bachorik 2011-10-05 16:44:04 UTC
Actually, it is enough to set java.** as a profiling root.
Comment 2 Tomas Hurka 2011-11-08 17:03:07 UTC
It is enough to select java.lang.Thread.nextThreadNum() method as root method.
Comment 3 Tomas Hurka 2011-11-08 19:03:21 UTC
I am able to reproduce it with NB 7.0.1, so this is not a regression. Lowering priority to P3.
Comment 4 Jiri Sedlacek 2012-04-17 11:19:20 UTC
P2 - reproducible by the easiest action: just selecting the topmost (and now by default the only visible) checkbox in the Edit Profiling Roots dialog.
Comment 5 Tomas Hurka 2012-05-27 06:34:04 UTC
The root of the problem is in JNI method AttachCurrentThread. AttachCurrentThread invokes new Thread() in the same thread. In this situation any root method invoked by new Thread() will cause profiling to fail, because Thread.currentThread() returns partially initialized instance of Thread (the one from new Thread()).   Profiling fails in ProfilerRuntime.writeThreadCreationEvent(), which invokes getName() on uninitialized thread.
Comment 6 Tomas Hurka 2012-05-27 06:51:44 UTC
Fixed in profiler-main.

changeset:   222897:58eed9113091
user:        Tomas Hurka <thurka@netbeans.org>
date:        Sun May 27 08:49:41 2012 +0200
summary:     bugfix #203164, Thread.getName() can thrown NPE under special conditions (AttachCurrentThread)
Comment 7 Quality Engineering 2012-06-05 06:05:51 UTC
Integrated into 'main-golden', will be available in build *201206050001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/58eed9113091
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #203164, Thread.getName() can thrown NPE under special conditions (AttachCurrentThread)