New issue
Advanced search Search tips

Issue 707531 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



Sign in to add a comment

Breakpoints don't stop webworker execution

Reported by travis.g...@googlemail.com, Apr 1 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce the problem:
1. Have one or more webworkers running
2. Set a breakpoint somewhere in the code that is reachable by workers and/or the main thread
3. When the debugger breaks on the breakpoint, webworkers continue running

What is the expected behavior?
At least in previous versions, web worker execution halted.

What went wrong?
In my application, I use web workers to send messages to the main thread to do something. When you're trying to debug that *something*, other invocations of that same code (via workers) modify variables while you're debugging them, making debugging in general quite messy.

Did this work before? Yes 56.xxx

Chrome version: 57.0.2987.133  Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 25.0 r0

I'm not sure if this is actually unintentional, but at least an optional feature to break all workers when any of the web workers or the main thread break on a breakpoint (or when you manually pause one of them) would be very nice. As is, debugging code as in the situation described above is not really possible.

It's also possible I'm missing something and the observed behavior is caused by something else.
 
Actually, reading the issue the description is probably not accurate as to what's going on. Web worker execution never halted in previous versions, sorry about that... Here's a better description:

I'm talking about code where the main thread listens to web worker messages, and inside the callback for that, it calls some function to do work. 

And if you try to debug that function (or anything that is inside it), other invocations of that function keep happening in the background, and those don't break on the same breakpoint.

In previous versions, what (I think) happened was that those invocations, too, halted on that breakpoint (they got queued up until you fully continued execution of the code [so not just single line stepping]) and you could debug them one after the other. 

This, of course, had the drawback that when disabled the breakpoint and continued, it ran through all of those queued up executions, which could lead to quite a slowdown if you debugged a while without manually halting web workers. It's possible that this is why it was changed.
Labels: Needs-Triage-M57
Labels: -Needs-Triage-M57 TE-NeedsTriageHelp
Status: WontFix (was: Unconfirmed)
The main thread is single threaded, unless there are timers, promises, or other async things happening, the main thread will not process any message from the worker until the execution stack is finished.

We do not want to force the worker to halt as that would be even more confusing since a worker is designed to be able to always execute in another execution context (concurrently).

It is possible to write some hooks into your code to assist you in debugging like, set a breakpoint in the worker just before message is sent to main thread then step to after the postMessage occurs then keep worker paused while you debug main thread.

This is largely tricky because workers are allowed to queue messaged to main thread or to any channel including other works. This in theory means that works should be able to communicate with each other even if main thread is paused.

I am going to mark as WontFix, but if you feel strongly about this we can dive deeper into it.

Thanks!

Sign in to add a comment