Closed Bug 1003055 Opened 10 years ago Closed 9 years ago

"Connection closed" error when tab or toolbox is closed

Categories

(DevTools :: Inspector, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: pbro, Unassigned)

Details

Attachments

(1 file)

STR:
- Open the inspector on about:home
- Close the tab (not just the toolbox)
--> The following error is displayed in the logs:

console.error: 
  Message: Error: Connection closed
  Stack:
    Front<.destroy@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:1041:7
exports.WalkerFront<.destroy@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/inspector.js:2103:5
frontProto/</proto[name]/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:1223:11
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:40:11
then@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:20:43
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:72:11
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:40:11
then@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:20:43
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:72:11
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:40:11
then@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:20:43
resolve@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/deprecated-sync-thenables.js:72:11
Front<.onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/protocol.js:1112:7
DebuggerClient.prototype.onPacket/<@resource://gre/modules/devtools/dbg-client.jsm:693:9
resolve@resource://gre/modules/devtools/deprecated-sync-thenables.js:40:11
then@resource://gre/modules/devtools/deprecated-sync-thenables.js:20:43
then@resource://gre/modules/devtools/deprecated-sync-thenables.js:58:9
DebuggerClient.prototype.onPacket@resource://gre/modules/devtools/dbg-client.jsm:735:1
LDT_send/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/transport.js:279:11
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:84:7

As far as I was able to investigate, here is what's going on:

- some pages mutate markup when the tab is closed, in the case of about:home, there's an attribute that's removed or added on <html>
- this makes the WalkerActor fire a "new-mutations" event right when the toolbox is being closed and the server being shutdown and actors disconnected
- the WalkerFront defines a preEvent custom method which is executed when the event is received on the front. It uses this to, in turn, send a request to the actor: getMutations
- protocol.js rejects this request because it is destroying the front.
Another set of STRs:
- go to google.com
- open the inspector
- close the toolbox (not the tab this time)
--> Same error in the logs.
(In reply to Patrick Brosset [:pbrosset] [:patrick] from comment #0)
> - some pages mutate markup when the tab is closed, in the case of
> about:home, there's an attribute that's removed or added on <html>
> - this makes the WalkerActor fire a "new-mutations" event right when the
> toolbox is being closed and the server being shutdown and actors disconnected
> - the WalkerFront defines a preEvent custom method which is executed when
> the event is received on the front. It uses this to, in turn, send a request
> to the actor: getMutations
> - protocol.js rejects this request because it is destroying the front.
not because it is destroying the front, but rather because the actor has already been destroyed in the meantime.


(In reply to Patrick Brosset [:pbrosset] [:patrick] from comment #1)
> Another set of STRs:
> - go to google.com
> - open the inspector
> - close the toolbox (not the tab this time)
> --> Same error in the logs.
Most probably due to the fact that google.com mutates nodes on window resize and closing the toolbox changes the window size.
This silences 1 of the stack traces in the logs.
We had a console.error rejected promise handler in the WalkerFront's preEvent method which I think isn't really needed.
Still, the error thrown in protocol.js [1] goes into the log.

I can't really think of a way to fix this to be honest. The problem comes from the way the walker actor and front are working together and from the fact that there doesn't seem to be a way for the front or actor to know if the other side still exists unless by trying to send a request or a response.

[1] http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/protocol.js#1040
This doesn't happen anymore.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: