Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 169219 - [Progress] ProgressManager doesn't remove job from jobs hash map
Summary: [Progress] ProgressManager doesn't remove job from jobs hash map
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P1 major (vote)
Target Milestone: ---   Edit
Assignee: Alex Nan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 169339
  Show dependency tree
 
Reported: 2006-12-28 20:00 EST by Alex Nan CLA
Modified: 2016-05-05 10:48 EDT (History)
2 users (show)

See Also:


Attachments
Sample Apache access log (11.38 KB, application/octet-stream)
2006-12-28 20:02 EST, Alex Nan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Nan CLA 2006-12-28 20:00:33 EST
Build ID: M20060921-0945

Steps To Reproduce:
1. Install Eclipse 3.2.1 M20060921-0945
2. Install on top EMF/XSD 2.1.1 from http://download.eclipse.org/tools/emf/downloads/drops/2.2.2/M200612140300/emf-sdo-xsd-SDK-M200612140300.zip
and TPTP-4.2.2-200612191126 from http://www.eclipse.org/downloads/download.php?file=/tptp/4.2.2/dev/TPTP-4.2.2-200612191126/tptp.sdk-TPTP-4.2.2-200612191126.zip.
3. Launch the workbench and from the main menu choose File->Import->Profiling and Logging->Log file
4. In the import log wizard choose Add and select to import the Apache access log file attached to this defect.
5. Click Finish to start importing the Apache log file and swithc to the "Profiling and Logging" perspective when asked.
Notice the "Importing log file..." job label displayed on the status bar. If this status label is cleared try to import again the same log file and choose to replace the previously imported one.
Notice that this time the status label doesn't go away although the job has finished. Sometimes the status label doesn't get cleared on the first log import.


More information:
I did some investigation and found out that the culprit for the label not being cleared is the fact that org.eclipse.ui.internal.progress.ProgressManager is not removing the import log job from it's jobs hash map in the method  public void done(IJobChangeEvent event), part of the JobChangeAdapter created in 
  */
    private void createChangeListener() {
        changeListener = new JobChangeAdapter() {...}
Not sure why this is happening only for this particular job.
The problem is that all the subsequent import log jobs are not cleared and this is causing a memory leak which could become problematic. The org.eclipse.ui.internal.progress.ProgressCanvasViewer is using the org.eclipse.ui.internal.progress.ProgressViewerContentProvider and this one is using the org.eclipse.ui.internal.progress.ProgressManager to get it's content. This is the reason why the  import log job name keeps getting displayed.
Comment 1 Alex Nan CLA 2006-12-28 20:02:47 EST
Created attachment 56232 [details]
Sample Apache access log

Attaching a sample Apache access log file required for reproducing the problem.
Comment 2 Alex Nan CLA 2006-12-28 20:06:55 EST
Changing sev to major since the problem is causing a memory leak which could potentially be troublesome.
Comment 3 Tod Creasey CLA 2007-01-30 15:52:04 EST
The issue is in ImportLogWizard - you are calling done on the progress monitor after the job is finished so I am getting a request for info after I removed it from the cache.

I'll need to see the source of this to see what the issue is but it looks like you are calling done() after the progress monitor is no longer valid
Comment 4 Alex Nan CLA 2007-01-30 17:03:26 EST
OK, I think I see the problem, but still I think this is a bit strange since I am pretty sure it didn't happen in previous releases of Eclipse. The same client code worked in Eclipse 3.1. I agree the clients have to be careful not to call done() on an "invalid" monitor, but would it be not good practice if also the Eclipse code, to be on the safe side, would ensure that initialization of the job info happens  only on a valid monitor? 
Can you assign this defect to me please, i.e. apnan@ca.ibm.com. I have verified that by removing the unnecessary done() the problem dissapears.
Thanks for your time and sorry for the inconvenience that this issue may have caused you.
Comment 5 Alex Nan CLA 2007-01-30 17:05:08 EST
Bob has retired and I cannot assign this defect to myself unfortunately.
Comment 6 Eugene Chan CLA 2007-01-30 17:13:44 EST
Assign to Alex as requested
Comment 7 Alex Nan CLA 2007-01-30 17:21:21 EST
And in continuation of what I said before, according to the java doc of the IProgressMonitor interface, the done() method may be called more then once, implementations should be prepared to handle this case.
Comment 8 Tod Creasey CLA 2007-01-31 07:56:08 EST
We certainly should protect against this - please feel free to log me a bug if you like.

We should also specify in the javadoc of Job that the monitor should not be used outside of the life of the job
Comment 9 John Arthorne CLA 2007-01-31 10:49:28 EST
The problem is very similar to bug 149857.. the fix for that bug only fixed the case where isCanceled is called after the job completes, rather than fixing the general problem.
Comment 10 Alex Nan CLA 2007-01-31 11:02:29 EST
I have opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=172327 for this issue. Not sure if Platform.UI is the right component though.
Comment 11 Alex Nan CLA 2007-02-02 00:28:37 EST
Fixed.
Comment 12 Alex Nan CLA 2007-06-08 19:26:33 EDT
Verified with TPTP-4.4.0-200706070100
Comment 13 Alex Nan CLA 2007-06-08 19:26:48 EDT
Closing.