Closed Bug 1544976 Opened 6 months ago Closed 6 months ago

Quick teardown of workers causes Debugger to fail loading

Categories

(DevTools :: Debugger, defect, P2, major)

defect

Tracking

(firefox68 fixed)

RESOLVED FIXED
Firefox 68
Tracking Status
firefox68 --- fixed

People

(Reporter: Harald, Assigned: bhackett)

References

Details

(Whiteboard: [debugger-mvp])

Attachments

(4 files, 1 obsolete file)

What were you doing?

  1. Open Debugger on https://worker-teardown.glitch.me/

What happened?

Debugger doesn't load, stays gray.

What should have happened?

Debugger loads.

Anything else we should know?

Flurry of 1 error and 2 types of warnings keeps showing up in Browser Console:

Error while detaching the thread front: No such actor for ID: server1.conn1.child1/workerTarget1064/context1 target-mixin.js:555:21
Handler function DebuggerClient.requester threw an exception: Error: resume command sent while not paused. Currently attached
Stack: _assertPaused@resource://devtools/shared/client/thread-client.js:55:13
before@resource://devtools/shared/client/thread-client.js:80:12
DebuggerClient.requester/<@resource://devtools/shared/client/debugger-client.js:103:31
exports.makeInfallible/<@resource://devtools/shared/ThreadSafeDevToolsUtils.js:109:22
resume@resource://devtools/shared/client/thread-client.js:122:17
updateWorkerClients@resource://devtools/client/debugger/src/client/firefox/workers.js:42:20
Line: 55, column: 13 ThreadSafeDevToolsUtils.js:88:13

Error while detaching target: undefined target-mixin.js:547:21

Error while detaching the thread front: No such actor for ID: server1.conn1.child1/workerTarget1070/context1 target-mixin.js:555:21
Priority: -- → P2

Brian, could you take a look at this?

Flags: needinfo?(bhackett1024)
Assignee: nobody → bhackett1024

I'll look into fixing the error messages, but I see these in the usual case when closing a page with workers or after a worker is terminated, and they don't necessarily indicate a problem.

The debugger loads fine on the page for me, though. Does this still happen for you on tip? Can you paste a complete log from the browser console or from running firefox from a terminal (the errors should be printed to stderr).

Flags: needinfo?(bhackett1024)

It isn't easy reproduce it with the example now. It worked for me 3 times and I had to re-open Debugger once to hit it.

Another sign that the Debugger stopped working is that it does load the Debugger but doesn't show Threads anymore. Browser Console warnings for this case were:

Error while detaching the thread front: 'detach' request packet to 'server1.conn9.child1/context17' can't be sent as the connection is closed. target-mixin.js:555:21
Error while detaching target: undefined target-mixin.js:547:21
Error while detaching the thread front: No such actor for ID: server1.conn10.child1/workerTarget47/context1 target-mixin.js:555:21
Error while detaching target: undefined 2 target-mixin.js:547:21
Error while detaching target: undefined 2 target-mixin.js:547:21
Error while detaching the thread front: No such actor for ID: server1.conn10.child1/workerTarget49/context1 target-mixin.js:555:21
Error while detaching the thread front: No such actor for ID: server1.conn10.child1/workerTarget50/context1 target-mixin.js:555:21
Error while detaching the thread front: No such actor for ID: server1.conn10.child1/workerTarget48/context1 target-mixin.js:555:21
Error while detaching the thread front: No such actor for ID: server1.conn10.child1/workerTarget54/context1 target-mixin.js:555:21
Error while detaching the thread front: 'detach' request packet to 'server1.conn10.child1/context17' can't be sent as the connection is closed. target-mixin.js:555:21

Have to reproduce on a fresh profile to get the stderr.

OK, thanks, I was able to reproduce this by tweaking the test case to create/destroy workers more frequently. The messages above are all just noise, actually, and printed out when we successfully recover from a protocol error due to a terminated worker thread. Part 2 adds a preference to stop printing those. The actual problem was due to a promise rejection after receiving an error from the server in debugger-client.js, and either wasn't being printed at all or was being printed as a very subtle console.error() call. I'd like to understand sometime why we don't print out these unhandled rejections, because they are a leading cause of debugger breakage in my experience.

Pushed by bhackett@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1ebc89e3ad97
Part 1 - Ignore exceptions thrown while attaching to worker threads, r=loganfsmyth.
https://hg.mozilla.org/integration/mozilla-inbound/rev/30b551b1a212
Part 2 - Add devtools.debugger.quiet quiet pref to suppress warnings from protocol errors, r=loganfsmyth.
Backout by shindli@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/618d85aa18ee
Backed out 2 changesets for causing xpcshell failures in devtools/client/memory/test/unit/test_action_diffing_02.js
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
Backout by nbeleuzu@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/53014805c60b
Backed out 2 changesets for causing xpcshell failures in devtools/client/memory/test/unit/test_action_diffing_02.js. a=backout
Pushed by bhackett@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/26916fd0f252
Ignore exceptions thrown while attaching to worker threads, r=loganfsmyth.
Status: REOPENED → RESOLVED
Closed: 6 months ago6 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 68
Whiteboard: [debugger-mvp]

I didn't land the pref here because it caused some weird xpcshell failures and I wasn't feeling very motivated to figure them out.

Flags: needinfo?(bhackett1024)
Flags: qe-verify+
Attached image debugerCrrashMe.gif

In an attempt to verify the fix, I was able to reproduce with 67.0.4 after spamming the open/close DevTools key (F12) with the Debugger tab in focus.

After a quick check with 68.0b13, 69.0a1 (2019-06-30) there was a different behavior as per the description, the whole tab crashed.
Adding a recording with this comment and will post the log bellow.

Attached file log.txt (obsolete) —

@Brian, mind taking a look at this as well?
Is it something that needs to be filed separately or part of the fails mentioned in comment #14?

Thank you!

Flags: needinfo?(bhackett1024)
Attached file log.txt
Attachment #9075126 - Attachment is obsolete: true

Sorry for the late reply. The errors in the log are pretty innocuous, those are often printed if the devtools shut down while user interactions are still being handled. Did you get a crash report for the tab crash?

Flags: needinfo?(bhackett1024)
You need to log in before you can comment on or make changes to this bug.