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

async_hooks fails obscurely when double initialized #2653

Open
mhofman opened this issue Dec 5, 2024 · 0 comments
Open

async_hooks fails obscurely when double initialized #2653

mhofman opened this issue Dec 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mhofman
Copy link
Contributor

mhofman commented Dec 5, 2024

Describe the bug

SES has double init checks to produce clear errors when trying to lockdown the environment twice. However it seems that when async_hooks taming is involved through @endo/init, the error becomes a lot more obscure.

Steps to reproduce

package.json:

{
  "type": "module",
  "dependencies": {
    "@endo/init": "^1.1.7",
    "endo-old-init": "npm:@endo/init@1.1.4"
  }
}

foo.js:

import "endo-old-init/debug.js";
import "@endo/init/debug.js";

console.log("done");

Expected behavior

SES_ALREADY_LOCKED_DOWN error

Platform environment

@endo/init: 1.1.7

Additional context

Originally discovered by running yarn test:fast-usdc in https://github.com/Agoric/agoric-sdk/tree/bce5b917edace606af3cd468927b51f97fea5a51/multichain-testing

Screenshots

SES_UNCAUGHT_EXCEPTION: (TypeError#1)
TypeError#1: Cannot redefine property: Symbol(async_id_symbol)
    at InertConstructor.defineProperty (<anonymous>)
    at setup (file:///home/node/workspace/agoric/tmp/repro-endo-double-init/node_modules/@endo/init/src/node-async_hooks.js:216:10)
    at file:///home/node/workspace/agoric/tmp/repro-endo-double-init/node_modules/@endo/init/src/node-async_hooks-patch.js:4:1
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:34:7)
    at async handleMainPromise (node:internal/modules/run_main:106:12)

Additionally the InertConstructor.defineProperty is confusing, but orthogonal.

@mhofman mhofman added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant