This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 299755 - "Chaining" of injections prevents updates from being propagated
Summary: "Chaining" of injections prevents updates from being propagated
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.0 M4   Edit
Assignee: Oleg Besedin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-15 07:33 EST by Remy Suen CLA
Modified: 2010-01-18 16:07 EST (History)
2 users (show)

See Also:


Attachments
Tests patch to reproduce the problem (4.67 KB, patch)
2010-01-15 10:58 EST, Remy Suen CLA
no flags Details | Diff
Tests patch to reproduce the problem v2 (5.21 KB, patch)
2010-01-15 11:13 EST, Remy Suen CLA
no flags Details | Diff
Workaround patch (1.62 KB, patch)
2010-01-15 11:35 EST, Remy Suen CLA
no flags Details | Diff
Fix (3.04 KB, patch)
2010-01-18 15:56 EST, Oleg Besedin CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2010-01-15 07:33:12 EST
eclipse-e4-SDK-incubation-I20100114-2115-win32.zip

1. Start the demo.
2. Make an album.
3. Close the demo.
4. Copy an image that has exif data over to the created album (see bug 263898).
5. Restart the demo.
6. Click the album, the thumbnails show are rendered.
7. Switch to the 'Exif' view. The table is populated.
8. Close the demo.
9. Restart the demo.
10. The 'Exif' view is empty, this is expected.
11. Select the album. The 'Exif' view remains empty.
12. Switch to the 'Thumbnails' view. This view is populated.
Comment 1 Remy Suen CLA 2010-01-15 07:34:43 EST
Unrelated to perspectives. I thought it was when I made the report. Forgot to edit the summary when I realized it wasn't.
Comment 2 Remy Suen CLA 2010-01-15 08:48:59 EST
(In reply to comment #0)
> eclipse-e4-SDK-incubation-I20100114-2115-win32.zip
> 
> 1. Start the demo.
> 2. Make an album.
> 3. Close the demo.
> 4. Copy an image that has exif data over to the created album (see bug 263898).
> 5. Restart the demo.

6. Activate the 'Exif' view.
7. Click the album. The 'Exif' view is not populated.

Even worse... :/
Comment 3 Remy Suen CLA 2010-01-15 09:45:30 EST
The @Inject annotation for the ExifTable's IEventBroker seems to be the cause. If I remove the annotation then selection changes appear to be received properly. Sounds crazy but this is what I'm seeing.
Comment 4 Remy Suen CLA 2010-01-15 10:58:25 EST
Created attachment 156239 [details]
Tests patch to reproduce the problem

Pretty straightforward test. Comment out the @Inject to get it to pass.
Comment 5 Remy Suen CLA 2010-01-15 11:13:06 EST
Created attachment 156243 [details]
Tests patch to reproduce the problem v2

This test is better as it doesn't depend on the event broker. The "chaining" on injections seems to be causing problems. Please look at lines 31 and lines 48.
Comment 6 Remy Suen CLA 2010-01-15 11:35:38 EST
Created attachment 156246 [details]
Workaround patch

This patch changes ExifTable to work around the problem. It has been released to HEAD.
Comment 7 Oleg Besedin CLA 2010-01-15 11:42:07 EST
The problem is in the TrackableComputationExt#hashCode() : both "outer" computation that makes Exif part and the "inner" computation have the same runnable. The hashCode() evaluates to the same value, and by the time "outer" listener is added, there is the listener with the same has code in the HashSet from the "inner" computation.
Comment 8 Oleg Besedin CLA 2010-01-15 13:09:47 EST
This turns out to be a non-trivial problem. The "simple" fix would be to remove #equals() and #hasCode() overrides on the TrackableComputation, TrackableComputationExt, and ValueComputation. But I am not sure if that is the "right" fix...
Comment 9 Remy Suen CLA 2010-01-18 08:55:43 EST
Can't really think of a better summary but I figured I'd change it to something that half described the bug in question.
Comment 10 Oleg Besedin CLA 2010-01-18 15:56:21 EST
Created attachment 156441 [details]
Fix

The patch merges lists of dependent names for context listeners for listeners that have "equal" listsners already added to the context.

(Context injection creates runnables based on the context [ObjectProviderContext]; both "outer" and "inner" #make() calls are "equals" as #equal() overrides take only runnable in account and ignore dependents lists. The solution in this pacth is to merge dependent context/names lists.)

(The simple solution of removing #equals() overrides does not work as other calculations rely on the runnable being added only once to the listener list. Ignoring that causes duplicate entries added when, say, a dependent entry is removed from a parent context.)
Comment 11 Oleg Besedin CLA 2010-01-18 16:01:35 EST
Patch "Fix" and Remy's test patch applied to CVS Head. I'll reverse change to the ExifTable from "Workaround Patch" as I merge my other work for that bundle.

Thank you for finding this out - this certainly was the weirdest bug I've seen so far for the context injection.
Comment 12 Remy Suen CLA 2010-01-18 16:07:15 EST
(In reply to comment #11)
> Patch "Fix" and Remy's test patch applied to CVS Head.

Awesome, thanks Oleg.

> I'll reverse change to
> the ExifTable from "Workaround Patch" as I merge my other work for that bundle.

Sounds good to me.

> Thank you for finding this out - this certainly was the weirdest bug I've seen
> so far for the context injection.

Yeah, this one was really weird. ;)