Closed
Bug 1019964
Opened 10 years ago
Closed 10 years ago
call-watcher should not store strong references
Categories
(DevTools Graveyard :: Web Audio Editor, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Firefox 33
People
(Reporter: jsantell, Assigned: jsantell)
References
Details
Attachments
(1 file, 4 obsolete files)
4.79 KB,
patch
|
jsantell
:
review+
|
Details | Diff | Splinter Review |
* call-watcher needs to not store strong reference
(gdb) js
0 anonymous() ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/call-watcher.js":387]
this = [object XrayWrapper [object AudioContext]]
1 <TOP LEVEL> ["http://people.mozilla.org/~eakhgari/webaudio/gain.html":25]
this = [object Window]
Also, side issue to remove WeakMaps from implementation, because issue WeakMap/Cu.getWeakReference where it holds a strong reference, I believe this can be fixed by removing WeakMaps since we have IDs:
0 anonymous(conn = [object Object], node = [object XrayWrapper [object AudioBufferSourceNode]]) ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webaudio.js":133]
this = [object Object]
1 constructor(instance = [object Object], arguments = [object XrayWrapper [object AudioBufferSourceNode]]) ["resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/ehsan/Library/Application%20Support/Firefox/Profiles/f42unlva.pb/extensions/jid0-edalmuivkozlouyij0lpdx548bc@jetpack.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/core/heritage.js":145]
this = [object Object]
2 anonymous(node = [object XrayWrapper [object AudioBufferSourceNode]]) ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webaudio.js":441]
this = [object Object]
3 anonymous(node = [object XrayWrapper [object AudioBufferSourceNode]]) ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webaudio.js":527]
this = [object Object]
4 anonymous(functionCall = [object Object]) ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webaudio.js":376]
this = [object Object]
5 anonymous(functionCall = [object Object]) ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/webaudio.js":339]
this = [object Object]
6 anonymous(details = [object Window],AudioContext,[object XrayWrapper [object AudioContext]],0,createBufferSource,[object Object],[object Object],[object Object],,[object AudioBufferSourceNode], functionCall = "AudioContext", [object XrayWrapper [object AudioContext]], 0, "createBufferSource", [object Object],[object Object],[object Object], , [object AudioBufferSourceNode]) ["resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/call-watcher.js":507]
this = [object Object]
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → jsantell
Assignee | ||
Comment 1•10 years ago
|
||
This allows natural GC to occur in webaudio actor, and tests pass for canvas/webgl tools. I still need to fix all of the GC event stuff for web audio tool (bug 980506), but wanted to get this to you to check out.
Attachment #8435236 -
Flags: review?(vporof)
Assignee | ||
Comment 2•10 years ago
|
||
Note, I noticed some callwatcher tests in the canvasdebugger, maybe we should label them as such (rather than canvasdebugger, but maybe still live there), so we can have tests for these shared actors somewhere
Comment 3•10 years ago
|
||
Comment on attachment 8435236 [details] [diff] [review]
1019964-call-watcher-weak-ref.patch
Review of attachment 8435236 [details] [diff] [review]:
-----------------------------------------------------------------
Did you do any manual testing? I'm doing some myself but it's always good to have a few more eyes on these sorts of changes.
::: toolkit/devtools/server/actors/call-watcher.js
@@ +84,5 @@
> result: result
> + });
> +
> + Object.defineProperty(this, "details", {
> + get: () => weakDetails.get() || {}
Why the need for || {} ?
Attachment #8435236 -
Flags: review?(vporof) → review+
Assignee | ||
Comment 4•10 years ago
|
||
This allowed the audio tools server side AudioNodes to become collected (in bug 980506) -- my only worry is that some things in canvas/audio tools that rely on the call-watcher holding a strong reference, and that we'll see weird results because of it. If that's the case, the canvas/audio tools should be the ones holding the strong reference, not the call-watcher. I'd like to land this after the uplift in a day or two, so we'll have 6 weeks to do more manual testing if the above is the case in any scenario.
The `|| {}` just ensures we don't get null and then accessing properties of `details`, like `details.result` wouldn't get an accessing property on null error.
Maybe the object that is being held by a weak reference should just be a normal object, with certain properties (caller, args, results, anything that could be an object), just being weak references.
let weakResult = Cu.getWeakReference(result);
let details = {
type: "SomeType",
name: "MethodName",
...
}
Object.defineProperty(details, "result", { get: () => weakResult.get() });
Actually, I like that much more, will update patch.
Assignee | ||
Comment 5•10 years ago
|
||
Updated with more obvious code, and doesn't aggresively use weak references for objects that are unnecessary.
Attachment #8435236 -
Attachment is obsolete: true
Attachment #8437333 -
Flags: review+
Comment 6•10 years ago
|
||
I have one abstract suggestion which I hope is helpful here. I think it might make sense to use the usual abstractions in the devtools code base a bit more cautiously when dealing with audio nodes. In my experience, it's too easy to introduce a string reference in large layers of JS abstractions, and this will be something which is going to be hard to test going forward, so perhaps it would make sense a bit to try to use the existing abstractions while thinking about what happens in the future when the assumptions that are true today will no longer be true...
Assignee | ||
Comment 7•10 years ago
|
||
Ehsan, I agree when dealing with GC and AudioNodes we should minimize clever/terse abstractions and err on the side of obvious solutions. Although tests in bug 980506 should illuminate any failures occurring (like something holding a strong reference to any audionode). Is this what you mean?
Assignee | ||
Comment 8•10 years ago
|
||
With bug 1022917 merged, pushing this to try:
https://tbpl.mozilla.org/?tree=Try&rev=c355749413b4
Assignee | ||
Comment 9•10 years ago
|
||
Attachment #8437333 -
Attachment is obsolete: true
Attachment #8438689 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Status: NEW → ASSIGNED
Comment 10•10 years ago
|
||
(In reply to comment #7)
> Ehsan, I agree when dealing with GC and AudioNodes we should minimize
> clever/terse abstractions and err on the side of obvious solutions. Although
> tests in bug 980506 should illuminate any failures occurring (like something
> holding a strong reference to any audionode). Is this what you mean?
Yeah, although I have to admit that when it comes to this stuff, I have little faith in any trest being able to catch all future issues... :/
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 11•10 years ago
|
||
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Comment 12•10 years ago
|
||
Backed out for causing bug 1025118. Confirmed by retriggers on the Try push :).
https://hg.mozilla.org/integration/fx-team/rev/60ffe76e0c01
Whiteboard: [fixed-in-fx-team]
Assignee | ||
Comment 13•10 years ago
|
||
Now with only web audio editor holding weak refs
Attachment #8438689 -
Attachment is obsolete: true
Attachment #8440163 -
Flags: review?(vporof)
Assignee | ||
Comment 14•10 years ago
|
||
Comment 15•10 years ago
|
||
Comment on attachment 8440163 [details] [diff] [review]
1019964-call-watcher-weak-ref.patch
Review of attachment 8440163 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/devtools/server/actors/call-watcher.js
@@ +267,5 @@
> * Starts waiting for the current tab actor's document global to be
> * created, in order to instrument the specified objects and become
> * aware of everything the content does with them.
> */
> + setup: method(function({ tracedGlobals, tracedFunctions, startRecording, performReload, holdWeak }) {
Need to add an entry to the request: { ... } params for `method`.
Attachment #8440163 -
Flags: review?(vporof) → review+
Assignee | ||
Comment 16•10 years ago
|
||
Added the request param
Attachment #8440163 -
Attachment is obsolete: true
Attachment #8440717 -
Flags: review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Comment 18•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 33
Updated•6 years ago
|
Product: Firefox → DevTools
Updated•6 years ago
|
Product: DevTools → DevTools Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•