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 213973 - Detach immediately after attach lefts profiled application in inconsistent state
Summary: Detach immediately after attach lefts profiled application in inconsistent state
Status: VERIFIED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Attach (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: jtau8042
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-11 13:11 UTC by jtau8042
Modified: 2012-08-21 10:38 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
fix (13.25 KB, patch)
2012-07-11 13:51 UTC, jtau8042
Details | Diff
Updated patch (8.83 KB, patch)
2012-07-25 14:57 UTC, Tomas Hurka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jtau8042 2012-06-11 13:11:32 UTC
While object liveness instrumentation is used:

If NetBeans are detached from the profiled application before the profiling initialization is done the InitiateProfilingThread is left waiting on NetBeans response.

Not stopped thread stack trace:

"*** Profiler Agent Special Execution Thread 2" daemon prio=10 tid=0x00007ff5d4008800 nid=0x16f4 in Object.wait() [0x00007ff61e725000]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x00000000d21828d8> (a java.lang.Object)
	at java.lang.Object.wait(Object.java:485)
	at org.netbeans.lib.profiler.server.ProfilerServer.getLastResponse(ProfilerServer.java:452)
	- locked <0x00000000d21828d8> (a java.lang.Object)
	- locked <0x00000000bb0dd698> (a java.lang.Class for org.netbeans.lib.profiler.server.ProfilerServer)
	at org.netbeans.lib.profiler.server.ProfilerInterface.getAndInstrumentClasses(ProfilerInterface.java:651)
	at org.netbeans.lib.profiler.server.ProfilerInterface.access$900(ProfilerInterface.java:70)
	at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.initiateInstrumentation(ProfilerInterface.java:226)
	at org.netbeans.lib.profiler.server.ProfilerInterface$InitiateProfilingThread.run(ProfilerInterface.java:136)
Comment 1 jtau8042 2012-07-11 13:51:48 UTC
Created attachment 121933 [details]
fix

PREPARE_DETACH message added to wireprotocol. This message tries to lock transaction in server and reports results. It also sets flag in profiler interface which is used by profiling initialization thread to stop.

The client on detech request repeatedly calls PREPARE_DETACH until the mcall succeeds. Then the detach sequence continues as before.
Comment 2 Tomas Hurka 2012-07-25 14:57:09 UTC
Created attachment 122361 [details]
Updated patch

Reviewed patch attached with minor changes
Comment 3 jtau8042 2012-07-30 14:40:17 UTC
changeset: http://hg.netbeans.org/profiler-main/rev/8da1a3e6b5da
Comment 4 Quality Engineering 2012-08-01 02:35:00 UTC
Integrated into 'main-golden', will be available in build *201208010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8da1a3e6b5da
User: Jan Taus <jtau8042@netbeans.org>
Log: #213973: Detach immediately after attach lefts profiled application in inconsistent state
Comment 5 Petr Cyhelsky 2012-08-21 09:09:19 UTC
verified