Open Bug 1594917 Opened 5 years ago Updated 2 years ago

Unhandled promise rejections from within workers sometimes take a long time to show up in the browser console

Categories

(DevTools :: Console, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: mstange, Unassigned)

References

Details

Steps to reproduce:

  1. Run the following code in the Browser Console:
var worker = new Worker(URL.createObjectURL(new Blob(["onmessage = async () => { throw new Error('error'); };"])));
// worker.onerror = function(e){ console.error("onerror", e); }; // not called for unhandled promise rejections
worker.postMessage("whaddup");
  1. Wait for the error to show up in the console.

Expected results:
The error should show up immediately.

Actual results:
Sometimes, around 30 seconds elapse before the error appears in the console.

Removing async makes the error appear instantly.

So, the ReportErrorRunnable may be suspended based on debugger stuff which could be involved.

:mstange, can you confirm that Worker.onerror is similarly delayed so that we can separate potential devtools console/UI issues from the lower level error reporting issue?

:bhackett, you've most recently been involved in this area, do you have any thoughts on this?

Flags: needinfo?(mstange)
Flags: needinfo?(bhackett1024)
Priority: -- → P3

onerror seems not to be called in that case.

I've updated comment 0 with a full testcase that you can run on your own.

Flags: needinfo?(mstange)

Whoops, I think my brain totally missed the async the first time. That is indeed different and probably not a regression. Dropping :bhackett's needinfo for now.

Thanks for the update and test-case. It's likely this has a Workers aspect to it, but I'm going to move this to devtools for visibility. I will continue to follow the bug. (And bug 1592584 which I think may be related in terms of how devtools attaches to workers for console purposes... and I'm cc'ing baku since he seemed to volunteer to work on Worker bugs again in that bug ;)

Component: DOM: Workers → Console
Flags: needinfo?(bhackett1024)
Product: Core → DevTools
See Also: → 1592584
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.