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

Bug 179157

Summary: XMLTraceDataProcessor leaks threads
Product: z_Archived Reporter: Neil Dunn <neildunn>
Component: TPTPAssignee: Marius Slavescu <slavescu>
Status: CLOSED FIXED QA Contact:
Severity: critical    
Priority: P1 CC: guru.nagarajan, jkubasta, popescu
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: closed460
Attachments:
Description Flags
Patch for XMLTraceDataProcessor none

Description Neil Dunn CLA 2007-03-24 12:04:40 EDT
Build ID: I20070209-1006

Steps To Reproduce:
Run 1 profile.
Run another profile.
Notice two threads called "Refresh UI" in the thread view of debuger.

More information:
The class XMLTraceDataProcessor in package
org.eclipse.hyades.trace.ui.internal.piclient of the
org.eclipse.hyades.trace.ui.internal.piclient module leaks threads.

Within the constructor a RefreshUI thread is created and started. A
new XMLTraceDataProcessor is create for each profile the RefreshUI
thread loop has no exit criteria, and thus never finishes, thus leaks
threads.

Data collection should not be so tightly coupled to the GUI.
I would suggest a more generic notification system about trace events
and model changes which UI code could get a handle on to update.

I'm happy to help with a reimplementation and bug fix.
Comment 1 Eugene Chan CLA 2007-03-25 02:00:13 EDT
Marius, would you please work with Neil on these?
Comment 2 Neil Dunn CLA 2007-04-17 04:23:35 EDT
Is any progress happening here? Should I think about proposing my own fix?
Comment 3 Neil Dunn CLA 2007-05-11 09:53:52 EDT
Any progress?
Comment 4 Valentina Popescu CLA 2007-05-14 09:25:12 EDT
I don't think the severity should be normal since this is a leaking issue; as a result the priority is not properly set.
Joanna, can you review this defect and mark it appropriately
Comment 5 Valentina Popescu CLA 2007-05-14 09:30:39 EDT
Neil, code contribution is accepted and appreciated. We have limited resources to apply to the existing code which is unfortunately affecting this issue as well.
Comment 6 jkubasta CLA 2007-05-14 09:37:38 EDT
Marius, please work on resolving this defect.  Thanks.
Comment 7 Marius Slavescu CLA 2007-05-14 10:16:47 EDT
This is a long standing problem, I plan to have a fix in 4.4, in parallel I'm  investigating other memory leak problems in the UI.
Comment 8 Marius Slavescu CLA 2007-05-28 11:01:26 EDT
Created attachment 68928 [details]
Patch for XMLTraceDataProcessor

Neil please try the attached patch.

I don't see any problem when running on T60p (CoreDuo), it might surface only on single CPU machines. I'll try to test on a single CPU machine also.

I tested with JVMPI profile and perfmon agents. I will also test with JVMTI.

The "Profile UI" thread should go away when the profile/statistical session ends (normal or by using Terminate action), XMLTraceDataProcessor.cleanUp() is supposed to be called at that point in time.

Here is what you should see in the console when running with ModelDebugger.debug=true (see /org.eclipse.tptp.platform.models/.options file):

Thread[TCPDataFiller,6,main] - SAXFragmentHandler.terminateParser() - done
	at org.eclipse.hyades.loaders.util.SAXFragmentHandler.terminateParser(SAXFragmentHandler.java:114)
	at org.eclipse.hyades.loaders.util.XMLLoader.cleanUp(XMLLoader.java:258)
	at org.eclipse.hyades.trace.ui.internal.piclient.XMLTraceDataProcessor.cleanUp(XMLTraceDataProcessor.java:1141)
	at org.eclipse.hyades.trace.ui.internal.piclient.XMLTraceDataProcessor.dataServerExited(XMLTraceDataProcessor.java:329)
	at org.eclipse.hyades.internal.execution.local.common.TCPDataServer$TCPDataProcessorNew.run(TCPDataServer.java:795)

Thread[Profile UI,6,main] - RefreshUI stopped
	at org.eclipse.hyades.trace.ui.internal.piclient.XMLTraceDataProcessor$RefreshUI.run(XMLTraceDataProcessor.java:876)

If you still see the problem please can you check if XMLTraceDataProcessor.dataServerExited is called?
Comment 9 Valentina Popescu CLA 2007-06-18 13:11:51 EDT
I am running on a T42 and with the attached patch I cannot reproduce the leaking issue.
The other comments regading the separation of the UI code from the data collection implementation are valid though and should be addressed in this defect.
While debugging this problem I noticed that there is another UI thread responsible for refreshing the UI, Profile_Refresh, created by the Profiling Monitor view ( PDProjectExplorer ). The data processor UI thread should be merged/moved into this one.
Comment 10 Valentina Popescu CLA 2007-06-25 10:42:43 EDT
Marius, please move defect to a valid target; 4.4 is closed
I would assume that this is not a mustfix for 4.4.0.1 so the next possible target would be 4.4.1
Comment 11 Guru Nagarajan CLA 2007-06-25 18:59:15 EDT
Marius - This has been retargetted to 4.4.1.
Please triage this to the right version
Comment 12 Marius Slavescu CLA 2007-07-05 08:52:00 EDT
The remaining fix was done in another defect.
Comment 13 Paul Slauenwhite CLA 2009-06-30 13:58:14 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.