Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pet daemon workers should support stepping debuggers (Chrome inspector or VSCode) #2426

Open
kriskowal opened this issue Aug 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kriskowal
Copy link
Member

What is the Problem Being Solved?

At time of writing, there are a number of hurdles to debugging pet dæmon workers, not least of which is documenting the portion of that story that works. That is:

To start your dæmon in debug mode, you need to spawn it from your CLI with the node --inspect flag. Today, that looks like:

$ packages/cli/bin/endo stop
$ node --inspect packages/cli/bin/endo start 

This ought to be a single endo subcommand that unconditionally restarts the daemon in debug mode. All workers currently inherit the debug flags by virtue of child_process.fork.

Once a debugger is attached, we do fine until we discover that the workers are running without Mathieu’s accommodations for async_hook (which is entrained by the debugger). This is simple neglect to use @endo/init. We instead import ses, shims, and @endo/lockdown/commit.js manually, much of which can be simplified.

Description of the Design

Presumably something like endo restart --inspect would start a debugger session. That requires us to figure out how to thread --inspect when using child_process.fork or fall back to child_process.spawn and set up IPC manually. (We currently daemonize the daemon and wait to hear it’s successfully started listening on its designated interfaces.)

Then we just need to use @endo/init instead of rolling our own version of that manually.

Within a VSCode terminal session with the attached debugger, the following should pause on the debugger line in debugme.js.

$ echo debugger > debugme.js
$ endo restart --inspect
$ endo make debugme.js

Furthermore, this should work:

$ echo 'export const make = () => "ok"' > makeme.js
$ endo make makeme.js
ok

As written today, that reports an error since the returned promise has async_hook symbol own properties that the marshaler does not expect.

Security Considerations

None.

Scaling Considerations

None.

Test Plan

TBD.

Compatibility Considerations

None.

Upgrade Considerations

None.

@kriskowal kriskowal added the enhancement New feature or request label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant