Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328163 - [contexts] Provide debug / trace functionality for context injection
Summary: [contexts] Provide debug / trace functionality for context injection
Status: ASSIGNED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: E4 (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 13:22 EDT by Oleg Besedin CLA
Modified: 2018-05-13 09:57 EDT (History)
5 users (show)

See Also:


Attachments
Screenshot of the tracing view (74.38 KB, image/x-png)
2010-10-19 13:31 EDT, Oleg Besedin CLA
no flags Details
The trace / debug view (55.78 KB, application/x-zip-compressed)
2010-10-19 13:33 EDT, Oleg Besedin CLA
no flags Details
Patch that adds debug hooks to the Eclipse contexts (11.41 KB, patch)
2010-10-19 13:34 EDT, Oleg Besedin CLA
no flags Details | Diff
Patch: find new listeners (17.98 KB, patch)
2010-10-22 11:55 EDT, Oleg Besedin CLA
no flags Details | Diff
Patch: organize listeners by name (3.05 KB, patch)
2010-11-01 13:40 EDT, Oleg Besedin CLA
no flags Details | Diff
Patch: improved refresh of the context tree (14.93 KB, patch)
2010-11-01 16:44 EDT, Oleg Besedin CLA
no flags Details | Diff
Current screenshot (46.51 KB, image/x-png)
2010-11-01 16:47 EDT, Oleg Besedin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Besedin CLA 2010-10-19 13:22:10 EDT
Debugging problems in contexts/DI combination is rather complicated. Let's see what tracing / visualization / debug helpers we can create to make it easier to understand contexts inner workings.
Comment 1 Oleg Besedin CLA 2010-10-19 13:31:13 EDT
Created attachment 181206 [details]
Screenshot of the tracing view
Comment 2 Oleg Besedin CLA 2010-10-19 13:33:50 EDT
Created attachment 181207 [details]
The trace / debug view

This bundle adds the contexts trace / debug view into the "Debug" category.
Comment 3 Oleg Besedin CLA 2010-10-19 13:34:39 EDT
Created attachment 181208 [details]
Patch that adds debug hooks to the Eclipse contexts
Comment 4 Oleg Besedin CLA 2010-10-19 13:47:41 EDT
The "Patch that adds debug hooks to the Eclipse contexts" is applied to CVS Head; the new trace/debug bundle is shared as:

  e4/org.eclipse.e4.ui/bundles/org.eclipse.e4.core.contexts.debug

Any feedback is very welcome. At this point I am trying to figure out what's useful vs. what we can reasonably do, so all ideas about what information is needed to visualize context injection are very welcome.

In plans:

- organize links page by context keys
  [I'd like to change the actual EclipseContext to work that way too, for performance reasons.]

- add snapshot / diff for context listeners to help catch leaks

- see if we can make this into a true debug view (i.e., debugging out of process, breakpoints)
Comment 5 Oleg Besedin CLA 2010-10-22 11:55:18 EDT
Created attachment 181515 [details]
Patch: find new listeners

The patch adds a "Snapshot" for contexts and their listeners along with the code that detects new listeners created since the snapshot was taken.

Few points:

- having new listeners does not mean a leak by itself; only having new listeners after repeat operations might indicate a leak. (For example, having new listeners after context menu is shown for the first time is probably OK; having new listeners every time that context menu comes up needs to be checked);

- to reduce false positives, we only check contexts that existed both in the "snapshot" time and in the current state; we don't compare short-lived contexts created between those two points in time. While such contexts and their listeners should not affect DI operations, normal garbage collection concerns still apply.

(Patch applied to CVS Head.)
Comment 6 Oleg Besedin CLA 2010-11-01 13:40:54 EDT
Created attachment 182162 [details]
Patch: organize listeners by name

Now that I've made the change for the bug 329208, this patch displays context listeners organized by the value they depend on in the context.

(Patch applied to CVS Head.)
Comment 7 Oleg Besedin CLA 2010-11-01 16:44:46 EDT
Created attachment 182174 [details]
Patch: improved refresh of the context tree

The refresh of the context tree is now done in 5-second intervals (if "Auto" is enabled), or initiated by the "Refresh now" button.

The context values in the view are stored as weak references allowing proper garbage collection. 

(Patch applied to CVS Head.)
Comment 8 Oleg Besedin CLA 2010-11-01 16:47:49 EDT
Created attachment 182175 [details]
Current screenshot