Bug 175526 - [Sync View] Multiple copies of same image created by sync view
Summary: [Sync View] Multiple copies of same image created by sync view
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform Team Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on: 199460 205070
Blocks:
  Show dependency tree
 
Reported: 2007-02-26 10:03 EST by John Arthorne CLA
Modified: 2021-12-07 02:42 EST (History)
4 users (show)

See Also:


Attachments
Sleak stack traces (24.80 KB, text/plain)
2007-02-26 10:03 EST, John Arthorne CLA
no flags Details
Patch to Compare to improve caching (8.62 KB, patch)
2007-07-23 15:09 EDT, Michael Valenta CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2007-02-26 10:03:13 EST
Build: I20070220

Test case:
1) Open sync view with various Java projects having incoming changes
2) Capture Sleak snapshot
3) Turn off all models in the sync view, Apply
4) Turn all models back on, Apply
5) Capture Sleak diff against 2)

Various icons sometimes have two or three copies created.  The Java icons such as project, package, and CU, sometimes are created two or three times, with slightly different stack traces. Note, this is not technically a leak - repeating the test case multiple times doesn't create more images.
Comment 1 John Arthorne CLA 2007-02-26 10:03:34 EST
Created attachment 59788 [details]
Sleak stack traces
Comment 2 Michael Valenta CLA 2007-04-24 13:34:04 EDT
We should switch to using the ResourceManager API to manage images so that images can be managed locally but shared globally. Givne that this is not a leak, I'm deferring it to 3.4.
Comment 3 Michael Valenta CLA 2007-07-23 15:09:13 EDT
Created attachment 74387 [details]
Patch to Compare to improve caching

This is a patch to compare that would ensure that only one of each combined icon is created. However, it does comparisons of the image data when looking for matches so I want to profile it before releasing.
Comment 4 Michael Valenta CLA 2007-07-24 09:35:00 EDT
I profiled it and the calls to equal didn't even show up so I think we're OK. Patch released to HEAD. Unfortunately, the fix is localized to compare so we still need to fix the duplicate images in the sync view.
Comment 5 Michael Valenta CLA 2007-08-01 11:26:16 EDT
Fix released to HEAD
Comment 6 Krzysztof Michalski CLA 2007-08-09 11:26:43 EDT
Build id: I20070806-1800
I followed steps from the first comment and I have got leak resources. 
Michael could you look at it once again?
Comment 7 Michael Valenta CLA 2007-08-09 11:42:34 EDT
I followed the steps in the original comment and did not see a leak. There were some images after the diff but that is expected since the view is still open. There did appear to be one duplicate but that was a Java Package with a warning on it. I suspect that one was created by JDT and the other by Team. Marking as verified.
Comment 8 Michael Valenta CLA 2007-08-09 12:32:55 EDT
Actually, after a bit more playing around, I did find a leak. I believe this is caused by DecorationOverlayIcon which uses the base image when calculating the hashCode and equals. This is a problem since the hashCode of the image depends on the handle which gets set to 0 when the image is disposed.
Comment 9 John Arthorne CLA 2007-08-09 12:59:07 EDT
Great find! I think it would be best to fix the implementation of Image equals and hashCode. Note also that unequal instances of Image become equal to each other after the images are disposed (since both their handles become zero). This isn't technically a violation of the equals/hashCode contract, but it's nevertheless confusing and likely to lead to errors for clients. Otherwise we'll need to track down and remove any use of Image as hashtable keys.
Comment 10 Michael Valenta CLA 2007-08-09 13:25:09 EDT
I have released a change to DecorationOverlayIcon to use an identity hash on the base image to avoid leaks for the time being. We may want to revert that based on the response to bug 199460.
Comment 11 Markus Keller CLA 2007-08-10 05:20:10 EDT
(In reply to comment #10)
This is also a partial fix for bug 181215.
Comment 12 Michael Valenta CLA 2007-09-10 13:36:44 EDT
I'm marking this as fixed since the code, as it stands, has fixed the reported issue.
Comment 13 Tomasz Zarna CLA 2007-09-19 08:14:11 EDT
I'm still able to see a leak. Below are steps I followed. I know that they don't remind the steps from the original comment, so I wouldn't mind if you decide to open a separate bug to address it.

1) Open sync view with projects having incoming and outgoing changes, conflicts are welcomed too (I had 2 ins, 50 outs and 1 conflict)
2) Capture Sleak snapshot
3) Switch to "Change Sets" model type using the drop down menu
4) Select all change sets and use "Expand All" action from the context menu
5) Switch to "Workspace" model type using the drop down menu
6) Select all change sets and use "Expand All" action from the context menu
7) Switch to "Java Workspace" model type using the drop down menu
8) Select all change sets and use "Expand All" action from the context menu
9) Switch back to "All Models" in the drop down menu
10) Turn on "Flat Presentation"
11) Turn it off
12) Turn off all models in the sync view using "Preferences...", Apply
13) Turn all models back on by clicking on "Enable All Participation Models" in the sync view
14) Capture Sleak Diff against 2). I was able to get even up to 70(!) Images in the Diff.
Comment 14 Michael Valenta CLA 2007-09-19 08:58:00 EDT
Reopening to investigate issue reported in previous comment.
Comment 15 Tomasz Zarna CLA 2007-12-03 06:12:42 EST
Sorry for the late response. We will investigate the issue during 3.4M5.
Comment 16 Tomasz Zarna CLA 2008-02-06 07:06:10 EST
I've just reproduce it on I20080205-0010 (a candidate for 3.4 M5). To make steps from comment 13 a little bit simpler:

1) Open sync view with projects having incoming, outgoing and conflicting changes. I had 53 ins, 83 outs and 15 conflicts.
2) Capture Sleak snapshot
3) Turn on "Flat Presentation"
4) Turn it off
5) Capture Sleak Diff against 2). I got 40 Images in the Diff.

Unfortunately, we don't have the manpower to address it at this time, but hopefully will find some during 3.4 cycle.
Comment 17 Szymon Brandys CLA 2008-05-09 04:23:17 EDT
Mass update - removing 3.4 target. This was one of the bugs marked for
investigation (and potential fixing) in 3.4 but we ran out of time. Please ping
on the bug if fixing it would be really important for 3.4, and does not require
API changes or feature work.
Comment 18 Eclipse Webmaster CLA 2019-09-06 15:38:28 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 19 Eclipse Genie CLA 2021-12-07 02:42:27 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.