-
Notifications
You must be signed in to change notification settings - Fork 74
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
In vscode debug session, node async_hooks promise keys appear too late #2700
Comments
Verfied to happen on current endo master $ git describe --tags --always
@endo/[email protected] |
Node doesn't add anything to the prototype, it's our patch that does that.
That is very surprising. It'd mean that our patch somehow didn't run. |
Ok the problem is that |
The following seems to fix the test above: diff --git a/packages/daemon/src/daemon-node.js b/packages/daemon/src/daemon-node.js
index 4c84c5502..8a7090ce0 100644
--- a/packages/daemon/src/daemon-node.js
+++ b/packages/daemon/src/daemon-node.js
@@ -2,10 +2,7 @@
/* global process */
// Establish a perimeter:
-import 'ses';
-import '@endo/eventual-send/shim.js';
-import '@endo/promise-kit/shim.js';
-import '@endo/lockdown/commit.js';
+import '@endo/init';
import crypto from 'crypto';
import net from 'net';
diff --git a/packages/daemon/src/worker-node.js b/packages/daemon/src/worker-node.js
index b0ca493c0..c61b2e31b 100644
--- a/packages/daemon/src/worker-node.js
+++ b/packages/daemon/src/worker-node.js
@@ -2,10 +2,7 @@
/* global process */
// Establish a perimeter:
-import 'ses';
-import '@endo/eventual-send/shim.js';
-import '@endo/promise-kit/shim.js';
-import '@endo/lockdown/commit.js';
+import '@endo/init';
import fs from 'fs';
import url from 'url'; |
Based on our discussion I filed #2711 |
Describe the bug
Node's async_hooks apparently adds symbol-named own properties to
Promise.prototype
and to (some?) individual promises. ForpassStyleOf
to judge a promise passable, ideally it should not have any own properties. However, to accommodate the own properties added by Node's async_hooks to an individual promise,checkPromiseOwnKeys
allows symbol-named own properties if they also already appear onPromise.prototype
and the properties are visibly safe enough(*).However, under the vscode debugger, entered using vscode JavaScript Debug Terminal, I have several times run into the
error, apparently because async_hooks added these to an individual promise instance but not to
Promise.prototype
.(*) This should test that the property is a non-configurable non-writable own data property with a visibly harmless value, such as a primitive. However, currently the test seems weaker than that and should be tightened.
Steps to reproduce
Check out a current endo and
yarn && yarn build
In vscode, set a breakpoint at
endo/packages/ses/src/error/assert.js
Line 373 in 895ea0a
In a vscode JavaScript Debug Terminal, run
If the debugger then runs until it stops in the state captured below, you've reproduced the problem.
(Note: Currently speculative that this happens on endo master. Currently I'm on a draft branch with changes that should make no difference. But not sure.)
Expected behavior
Not hitting this error
Platform environment
git describe --tags --always
)Additional context
I am currently working on a local draft of the
markm-flip-non-trapping-shim-default
branch. I will check later if this also happens on master.Screenshots
cli(markm-flip-non-trapping-shim-default)$ yarn test test/demo/index.test.js
In the vscode Debug Console when looking at the
checkPromiseOwnKeys
stack frameThe text was updated successfully, but these errors were encountered: