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

Bug 194543

Summary: Unload profiling data results in an exception
Product: z_Archived Reporter: Valentina Popescu <popescu>
Component: TPTPAssignee: Marius Slavescu <slavescu>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 CC: apnan, ewchan
Version: unspecifiedFlags: slavescu: review+
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: closed460
Attachments:
Description Flags
error image
none
Patch for 194543
none
patch
none
Latest patch for 194543. none

Description Valentina Popescu CLA 2007-06-26 23:30:18 EDT
Using the 4.4 driver, profile a simple java application using java 5
After the process is terminated try to run Unload profiling data; this result in an NPE error message

This problem has been reported by a user; I'll try to attach the .log file once I get it

Please investigate this for 4.4.0.1
Comment 1 Alex Nan CLA 2007-06-28 12:06:00 EDT
I am getting this exception:  
java.lang.NullPointerException
	at org.eclipse.hyades.trace.ui.internal.util.PerftraceUtil.hasExecutionInfo(PerftraceUtil.java:1356)
	at org.eclipse.hyades.trace.views.adapter.internal.ExecutionStatisticPage2.isEmpty(ExecutionStatisticPage2.java:145)
	at org.eclipse.hyades.trace.ui.TraceViewer.addViewPage(TraceViewer.java:218)
	at org.eclipse.hyades.trace.ui.TraceViewer.addViewPage(TraceViewer.java:230)
	at org.eclipse.hyades.trace.ui.TraceViewer.selectionChanged(TraceViewer.java:519)
	at org.eclipse.tptp.platform.common.ui.trace.internal.helpers.TraceUIManager.selectionChanged(TraceUIManager.java:348)

and an Eclipse error dialog. I assume this is the error in question.
Comment 2 Valentina Popescu CLA 2007-06-28 12:10:53 EDT
There was no error message in the log so I am not sure

I'll attach a screen cap of the UI as I received from the user
Comment 3 Valentina Popescu CLA 2007-06-28 12:12:39 EDT
Created attachment 72703 [details]
error image
Comment 4 Alex Nan CLA 2007-06-28 12:23:49 EDT
So what I did, I opened the agent with the Execution stats view then I unloaded the agent and then I again clicked on it in the Profiling monitors view, while the Execution stats view was open and the Link with viewer was on. The exception below is logged and an error dialog is displayed.
Comment 5 Valentina Popescu CLA 2007-06-28 12:32:24 EDT
I have no way to check that but looking at your steps this should be the same problem as reported here
Comment 6 Alex Nan CLA 2007-06-28 12:35:41 EDT
I cannot reproduce the error dialog that you have attached.
If no view is opened the unload operation doesn't cause any errors, but the problem is it doesn't seem to unload the resource from memory, probably some action, possibly a cached selection is keeping the resource in memory. Memory is not decreasing as a result of the unload.
Comment 7 Alex Nan CLA 2007-06-28 12:43:02 EDT
If unloading the agent and then opening the agent in the execution view no error occurrs.
Comment 8 Valentina Popescu CLA 2007-06-28 13:38:47 EDT
The leak issue will be addressed under https://bugs.eclipse.org/bugs/show_bug.cgi?id=194544
Comment 9 Alex Nan CLA 2007-06-28 17:43:27 EDT
Created attachment 72741 [details]
Patch for 194543

This patch is avoiding the null pointer exception is the views as well as in the the save action but doesn't solve the root cause of the problem, i.e. the fact  that the unload fails to remove the agents from memory, the agents are still in memory as proxy objects with no associated resource.
Comment 10 Valentina Popescu CLA 2007-06-28 22:55:46 EDT
Marius, can you review this fix please
I think Eugene is on vacation until Wednesday
Comment 11 Eugene Chan CLA 2007-06-29 01:27:56 EDT
Created attachment 72756 [details]
patch

Thanks Alex for your help and the patch. I review your patch and it looks safe to me. There is however a use case that still breaks. When users profile with Execution Analysis till it exits, save the resource, and then unload. View shows default page(gray page) but double clicking or right click>open view does not open the execution view anymore. Users will have to close the execution statistic view and reopen again.

I am attaching a patch here with the addition to fix the mentioned problem. Marius and Alex, please review. Thanks!
Comment 12 Alex Nan CLA 2007-06-29 11:01:16 EDT
Strange, I cannot seem to get an exception in this case, and I'm pretty sure I have tested this scenario. Can you tell me where the code is throwing the exception?
Comment 13 Valentina Popescu CLA 2007-06-29 11:54:09 EDT
I don't have more data than what I've already attached to the defect
Comment 14 Alex Nan CLA 2007-06-29 17:59:22 EDT
Created attachment 72803 [details]
Latest patch for 194543.

Here is a patch which solves some more problems that I found during testing.
The fix for the bug 194544 hopefully will resolve the root cause of these UI issues.
Comment 15 Harm Sluiman CLA 2007-06-30 20:57:06 EDT
I may be wrong, but I believe this is supposed ot be targeted and done in 4.4.0.1
Comment 16 Marius Slavescu CLA 2007-07-04 17:09:20 EDT
I reviewed and tested the patch from Alex.
Comment 17 Marius Slavescu CLA 2007-07-04 21:37:14 EDT
Partial fix in CVS.

Eugene please apply the remaining two files:
/org.eclipse.hyades.trace.views/src/org/eclipse/hyades/trace/views/adapter/internal/ExecutionStatisticPage2.java
/org.eclipse.hyades.trace.views/src/org/eclipse/hyades/trace/views/adapter/internal/PatternPage.java
Comment 18 Eugene Chan CLA 2007-07-05 00:20:01 EDT
(In reply to comment #17)
> Partial fix in CVS.
> 
> Eugene please apply the remaining two files:
> /org.eclipse.hyades.trace.views/src/org/eclipse/hyades/trace/views/adapter/internal/ExecutionStatisticPage2.java
> /org.eclipse.hyades.trace.views/src/org/eclipse/hyades/trace/views/adapter/internal/PatternPage.java
> 

patch are submitted.
Comment 19 Paul Slauenwhite CLA 2009-06-30 13:59:07 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.