Open Bug 1003097 (dbg-worker) Opened 10 years ago Updated 8 months ago

[meta] Worker debugging

Categories

(DevTools :: Debugger, task, P3)

x86
macOS
task

Tracking

(Not tracked)

People

(Reporter: ejpbruel, Unassigned)

References

(Depends on 19 open bugs)

Details

(Keywords: DevAdvocacy, meta, Whiteboard: [status:inflight][DevRel:P1][games:p1][platform-rel-Games])

The implementation plan for this is roughly as follows:
- Implement a Worker Debugger API (bug 757133)
- Implement a Worker Loader (bug 1003095)
- Get the debugger server to run in a worker
- Refactor the main server so it can talk to a worker server
- Create a UI for worker debugging
Status: NEW → ASSIGNED
Depends on: 1016301
Depends on: 1016304
I've added two new dependencies to this task:

- We can't use Promise.jsm inside a worker, partly because we can't load jsms inside a worker, but also
  because Promise.jsm itself depends on chrome APIs that are not available inside a worker. We need to
  either refactor Promise.jsm into an SDK module that works even when the Services object is not
  available, or get rid of this dependency all together and refactor the debugger server to use native
  promises, which is what bug 1016301 is about.
- We need a transport that can talk to the server over a MessagePort interface. This is what bug 1016304
  is about.
No longer depends on: 1016304
I've been lax in reporting my progress on this bug, but not for lack of any!

It turns out that creating a worker transport was rather trivial, and getting the debugger server to run in a worker was not as hard as I had feared, so I moved forward and finished the integration of the main server with the worker server, all in one go. As a result, I've closed bug 1016301 and opened up a new one (bug 1035206), that combines the following tasks:

- Implement a worker transport
- Get the debugger server to run in a worker
- Refactor the main server so it can talk to a worker server
Depends on: 1035206
No longer depends on: 1016301
Component: Developer Tools → Developer Tools: Debugger
Whiteboard: [status:inflight]
Summary: [meta] Allow Web Workers to be debugged → [meta] Worker debugging
Alias: dbg-worker
Depends on: 1119490
We finally landed the platform API for the worker debugger, so expect to see some progress happening here in the next few weeks!

Bug 1035206 was horribly outdated, so I decided to close it. I will open several new bugs to land the server, client, and UI parts of worker debugging.
Depends on: 1160199
Just so you get some sense of priority, this is something that developers ask me for all the time--specially since you can do this with Chrome already! And also because for responsiveness reasons we are going to be moving so much code to background threads with all the new Worker types (Service Workers, Audio Workers etc etc)... we cannot debug by postMessaging ;-)

Marking it as DevAdvocacy.
So you get some sense of urgency / feedback from developers: this is something that I'm asked for *all the time*.

Specially with the new "put as much as possible in a worker" move with ServiceWorkers, Audio Workers etc... we cannot debug by postMessaging, it's just not efficient. Also it makes Firefox look like the poor relative, because Chrome does have this already.

I'm marking this as DevAdvocacy to reflect this feedback, but it would be nice to hear about estimates on implementation so at least I can give people some sort of vague promise on when this would be a thing they can start using.
I don't know how to use Bugzilla it seems x)
Keywords: DevAdvocacy
(In reply to Soledad Penades [:sole] [:spenades] from comment #6)
> So you get some sense of urgency / feedback from developers: this is
> something that I'm asked for *all the time*.
> 
> Specially with the new "put as much as possible in a worker" move with
> ServiceWorkers, Audio Workers etc... we cannot debug by postMessaging, it's
> just not efficient. Also it makes Firefox look like the poor relative,
> because Chrome does have this already.
> 
> I'm marking this as DevAdvocacy to reflect this feedback, but it would be
> nice to hear about estimates on implementation so at least I can give people
> some sort of vague promise on when this would be a thing they can start
> using.

I'm currently in the process of rebasing the prototype I showed during the London workweek last year. The reason this all took so long is because it proved very hard to get reviews for the platform API patches. The good news is that those have all landed, so we should be able to move forward quickly. I expect to be able to land the rest of the prototype within a couple of weeks.

This week I'll still focus on fixing small bugs for devedition 40. After that, worker debugging will be my top priority. If you want to stay on top of things, bug 1160199 is the one I'm currently working on. Once that bug is fixed I'll add subsequent bugs to the meta bug here.

Note that I'm deliberately calling this a prototype because I assume we'll have to fix many papercuts before it becomes useful as a production tool. I can't realistically give you an estimate how long that will take until people start using it (it will initially be hidden behind a pref).

Moreover, the prototype I showed in London only supported dedicated top-level workers, so no child workers, shared workers or service workers. Having said that, adding support for those should not be terribly difficult once we get the base case stable.
Depends on: 1164077
Depends on: 1164564
(In reply to Eddy Bruel [:ejpbruel] from comment #8)
> Moreover, the prototype I showed in London only supported dedicated
> top-level workers, so no child workers, shared workers or service workers.
> Having said that, adding support for those should not be terribly difficult
> once we get the base case stable.

Considering that ServiceWorkers are top-level workers, but don't necessarily have an associated window, how easy would it be to add support for them? Any way I can help?
Blocks: 1164832
Depends on: 1168853
Depends on: 1169343
Depends on: 1171967
Depends on: 1175550
Depends on: 1178726
I will still be working on this. I just don't think it makes sense to assign a meta bug to one person ;-)
Assignee: ejpbruel → nobody
Status: ASSIGNED → NEW
Whiteboard: [status:inflight] → [status:inflight][gaming-tools]
Priority: -- → P1
Depends on: 1227639
Jukka, which bugs here are most important for game debugging?
Flags: needinfo?(jujjyl)
Being able to debug and profile into workers is the biggest priority. This looks like bugs 1227639, 1192896 and 1119490. Right now the new SharedArrayBuffer specification is not yet being used much since the spec is expected to land in H1 2016 (implementation already does exist in Nightly and Emscripten supports it), but after it does land, it's expected that the need for bug 1152856 will explode dramatically, and will probably be the single most important one. Also bug 1047663 looks rather grim that it could cause a lot of unexpected behavior.

Btw, do we have a bug number for extending the profiler to workers? That feature has been asked several times by partner companies.
Flags: needinfo?(jujjyl)
Depends on: 1241958
Depends on: 1241961
Depends on: 1241963
Depends on: 1241964
Depends on: 1241965
No longer blocks: 1225912
Whiteboard: [status:inflight][gaming-tools] → [status:inflight]
No longer depends on: 1246306
Depends on: 1247192
Depends on: 1252818
Whiteboard: [status:inflight] → [status:inflight][DevRel:P1]
Whiteboard: [status:inflight][DevRel:P1] → [status:inflight][DevRel:P1][games:p1]
Whiteboard: [status:inflight][DevRel:P1][games:p1] → [status:inflight][DevRel:P1][games:p1][platform-rel-Games]
platform-rel: --- → ?
platform-rel: ? → ---
Product: Firefox → DevTools
No longer depends on: 1241958
Depends on: 1209640
Depends on: 1283587
Depends on: 1280737
Depends on: 1523262
Depends on: 1260239
Depends on: 1529163
Priority: P1 → --
Depends on: 1545650
Depends on: 1546603
Depends on: 1538345
Priority: -- → P3

Harald, could you refresh this meta? Several bugs seem out of date and could probably be closed...

Depends on: 1550057
Depends on: 1279993
Depends on: 1547320
Depends on: 1394478
Depends on: 1226285
Depends on: 1221892
Depends on: 1211035
Depends on: 1553242
Type: defect → task
Depends on: 1583424
Depends on: 1583671
Depends on: 1589908
Depends on: 1590766
Depends on: 1599926
Depends on: 1604329
Depends on: 1607778
Depends on: 1607923
Depends on: 1644746
Depends on: 1646213
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.