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

Bug 192300

Summary: On pause monitoring profiling data is still collected
Product: z_Archived Reporter: Alex Nan <apnan>
Component: TPTPAssignee: Eugene Chan <ewchan>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 CC: amehrega, ewchan, guru.nagarajan, jkubasta, samwai, sluiman
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:
Attachments:
Description Flags
Test application
none
patch
none
patched jar plugin none

Description Alex Nan CLA 2007-06-12 18:18:01 EDT
Launch the attached application from a command line in profiling mode using the -XrunpiAgent command. Create an attach configuration selecting Memory Analysis, add the following filter "java.awt.Button INCLUDE" and "* EXLUDE" and attach to the application. Open the Memory Sattistics view. Click twice on the Add button of the test application, observe that the view displays 4 instances of the java.awt.Button class. Pause monitoring and click two times more on the Add button, refresh the view, no changes are displayed which is correct. Resume monitoring and click again two times on the Add button and refresh the view, observe that now the number of Button instances  is 8 instead of 6.The same behaviour is observed when profiling to file, instances that are created while in pause mode are added to the total number of instances. 
This wasn't happening in 4.4 i2 and 4.4 i1.
Comment 1 Alex Nan CLA 2007-06-12 18:28:28 EDT
Created attachment 71095 [details]
Test application

Attaching a zip containig the sample application used to test the failing scenario.
Comment 2 Alex Nan CLA 2007-06-15 12:02:35 EDT
Raising this to critical, since it's a regression.
Comment 3 Samson Wai CLA 2007-06-15 13:28:32 EDT
Alex. This is not a regression. I am able to get 8 instances of the Button class using the 4.3.1, 4.4i2 and 4.4i3 AC drivers.
Comment 4 Alex Nan CLA 2007-06-15 13:55:16 EDT
Samson, I tried with a 4.3.1 RAC and client and it works as I expect it to work, the instances that are created duirng the pause are not counted when monitoring is resumed. 
Comment 5 Alex Nan CLA 2007-06-15 14:02:09 EDT
It looks like the 4.4 client is having differenlty, I tried with 4.4 client and 4.3.1 and also 4.4 RAC and I see the same behaviour that you see, which I believe is wrong. Perhaps the regression is on the client code.
Comment 6 Samson Wai CLA 2007-06-15 14:16:48 EDT
Hi Alex. Which component do you think this bug should belong to? Since AC/profiler is sending the same profiling data from 4.3.1 to 4.4, I think this is not an AC/profiler related bug. Thanks.
Comment 7 Alex Nan CLA 2007-06-15 14:20:12 EDT
Assign it to Platform.ProfilingPerspective for further investigation.
Comment 8 Samson Wai CLA 2007-06-15 14:26:32 EDT
Assigning to "Platform.UI.ProfilingPerspective" for further investigation.
Comment 9 Eugene Chan CLA 2007-06-15 16:55:39 EDT
I have a question here why is it a client UI problem? The client UI does not create/advance the instance value in the table by itself, but instead shows what it is given from the collector side? If the collector does not stop monitor on request and captures any instance value that it should be ignored and send to the UI, then UI will show what it is given.
Comment 10 Alex Nan CLA 2007-06-15 17:01:57 EDT
So from the tests it shows that the 4.4 client behaves differently then the 4.3.1 when using the same 4.3.1 RAC. I am not saying the UI is the problem but the UI is  a good place to start tracking the problem since the problem seems to be on the client side.
Comment 11 Eugene Chan CLA 2007-06-15 17:11:09 EDT
That's fair, it sounds to me the execution framework is not handling the stop monitoring event correctly. I will take a look at the stack between 4.3.1 and 4.4
Comment 12 Harm Sluiman CLA 2007-06-18 12:18:56 EDT
Other than the manual step of starting the app, this seems to map directly to the profile on server scenario, and it sounds like an agent problem since hte agent has to do special things to be silent while attached. Things like stack tracking etc..
Does this problem occur with profile on server as well/
Comment 13 Eugene Chan CLA 2007-06-18 14:01:54 EDT
(In reply to comment #12)
Same problem occurs to Profile on Server use cases. I see this problem only occurs to Memory Analysis but not Execution Time Analysis. ie. Instance created during 'pause' period is collected and shown in views, but invocations during the period is not collected nor shown in views. I profiled with JVMPI, I have to verify also on JVMTI. The pause monitoring action goes two different paths for JVMPI and JVMTI.
Comment 14 Eugene Chan CLA 2007-06-18 14:44:07 EDT
Confirmed with the 0618 driver that problems only exists in PI Memory Analysis, but not PI Execution Analysis, nor TI Memory Analysis and TI Execution Analysis.
Comment 15 Harm Sluiman CLA 2007-06-18 14:58:23 EDT
(In reply to comment #14)
> Confirmed with the 0618 driver that problems only exists in PI Memory Analysis,
> but not PI Execution Analysis, nor TI Memory Analysis and TI Execution
> Analysis.

So in end user terms, the problem will only hsow up if doing memory analysis of Java 1.4 because 1.5 and beyond are supported with TI based agents.
Comment 16 Eugene Chan CLA 2007-06-18 15:02:28 EDT
That's correct. and FYI, I was using IAC, I should also have tested with RAC even though the same agent should be applied and used in both use cases.
Comment 17 Eugene Chan CLA 2007-06-18 15:10:53 EDT
Same behavior is observed in RAC use cases. ie. Problem exists only with PI Memory Analysis.
Comment 18 Eugene Chan CLA 2007-06-18 15:26:16 EDT
Alex, I observed the same behavior in both 4.3.1 and 4.4 driver, with their corresponding RAC, which confirms Samson's comment #3, but inconsistent with your comment #4. Would you please confirm that again and maybe explain comment #5? Thanks in advance.
Comment 19 Alex Nan CLA 2007-06-18 17:50:09 EDT
Eith a 4.3.1 RAC and 4.3.1 client the memory statistics view doesn't display instances created during the pause time interval. With a 4.3.1 RAC and 4.4 client, the view displays all the instances, including the once created in the pause time interval.  With a 4.4 RAC and 4.4 client the same behaviour as in the previous case happens.
Comment 20 Alex Nan CLA 2007-06-18 18:13:31 EDT
I was able to reproduce the behaviour described in comment 19 on two windows 2000 machines. The problem also happens on Vista. Note that the scenario uses attach not launch.
Comment 21 Eugene Chan CLA 2007-06-18 18:41:49 EDT
OK. I talked to Alex. 
In 4.3.1 (both RAC and Client), the problem does not happen if (1) users select only Memory Analysis, but problem shows up when (23) users select BOTH Memory and Execution Analaysis together.
In 4.4 (both RAC and Client), the problem exists in both use case (1) select Memory Analysis only, and (2) select BOTH Memory and Execution Analysis.

I checked the call stack of the stop monitoring action code and it's exactly the same between 4.3.1 and 4.4. I suspect it's something with the Collection Mode sent over to the agent which is used back on loading process of data. I will try profile to file and compare the trace data between the 2 releases.
Comment 22 Eugene Chan CLA 2007-06-18 19:00:13 EDT
With 4.3.1 RAC and 4.4 Client, both (1) select Memory Analysis only and (2) select BOTH Memory and Execution Analysis fails the testcase.
Comment 23 Eugene Chan CLA 2007-06-18 19:10:57 EDT
Comparing between the trace files of 4.4 client and 4.3.1 client with the same 4.3.1 RAC.

There is a different in the option
4.3.1 :
<option key="STACK_INFORMATION" value="none"/>
4.4.0 :
<option key="STACK_INFORMATION" value="contiguous"/>

Comment 24 Eugene Chan CLA 2007-06-19 15:11:53 EDT
Created attachment 71792 [details]
patch 

patch that fix the regression in use case (1) select Memory Analysis only
Comment 25 Eugene Chan CLA 2007-06-19 15:12:59 EDT
Created attachment 71793 [details]
patched jar plugin

Alex, would you please test the patch with this jar plugin?
Comment 26 Eugene Chan CLA 2007-06-19 15:24:29 EDT
Samson, 

For use case (2): select BOTH PI memory and execution analysis, 
<option key="STACK_INFORMATION" value="normal"/> 
is sent to agent correctly, but it's treated as 
<option key="STACK_INFORMATION" value="contiguous"/>

Could you take a look at the problem on the agent side? Thanks for your time.
Comment 27 Eugene Chan CLA 2007-06-19 15:30:16 EDT
Ali, Would you please review the patch in comment #24?
Comment 28 Alex Nan CLA 2007-06-19 17:02:07 EDT
I have tested the patch and I confirm that the problem is resolved if using only the MEMORY_ANALYSIS option as explained in the original description of the defect. If both MEMORY_ANALYSIS and EXECUTION_ANALYSIS are used the problem still persists for the memory statistics results. The Execution statistics results are OK.
Comment 29 Eugene Chan CLA 2007-06-19 17:21:47 EDT
Thanks Alex for testing the fix.


Since the problem in use case (1) is a regression. I would like to get approval to have it fix before a complete fix for both use cases (1) and (2) is available.
Joanna, please advise?

A solution for user case (2) will not be available until comment #26 is resolved.
Comment 30 jkubasta CLA 2007-06-19 17:24:58 EDT
Please request approval.  If we can get PMC approval by eod, we should be able to include this patch in 4.4
Comment 31 Eugene Chan CLA 2007-06-19 18:18:56 EDT
(In reply to comment #24)
> Created an attachment (id=71792) [details]
> patch 
> 
> patch that fix the regression in use case (1) select Memory Analysis only
> 

Patch is approved by PMC, and submitted to CVS.
Comment 32 amehrega CLA 2007-06-20 11:30:22 EDT
(In reply to comment #27)
> Ali, Would you please review the patch in comment #24?
> 

Sorry for the late reply.  I tested and reviewed the patch and it looked fine.  
Comment 33 Eugene Chan CLA 2007-06-20 11:33:39 EDT
Thanks Ali for reviewing the patch.
Comment 34 jkubasta CLA 2007-06-21 13:01:34 EDT
Please resolve this defect as fixed
Comment 35 Eugene Chan CLA 2007-06-21 13:07:00 EDT
Joanna, only use case (1) is fixed. There is still use case (2) that is valid and not yet fixed. Should I target 4.4.0.1 or reopen a separate bug for the problem?
Comment 36 jkubasta CLA 2007-06-21 13:27:19 EDT
pls open a separate bug targeted to 4.4.0.1 and resolve this defect as fixed.  Thanks, Eugene.
Comment 37 Eugene Chan CLA 2007-06-21 13:43:07 EDT
close this bug, and opened bug 193797 to following up on use case 2.
Comment 38 Alex Nan CLA 2007-07-17 11:25:11 EDT
Verified in TPTP-4.4.0-200706140100C.
Comment 39 Alex Nan CLA 2007-07-17 11:25:34 EDT
Closing.