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

Calling async function fn() { x = await import('fs'); }; fn() causes SIGSEGV in REPL #38965

Closed
nettybun opened this issue Jun 8, 2021 · 5 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@nettybun
Copy link

nettybun commented Jun 8, 2021

What steps will reproduce the bug?

$ node
Welcome to Node.js v15.14.0.
Type ".help" for more information.
> async function fn() { x = await import('fs') }
undefined
> fn()
fish: “node” terminated by signal SIGSEGV (Address boundary error)

In v15.14.0 the x = part is required to cause the crash. In v16+ it seems this happens even without the variable assignment:

$ node
Welcome to Node.js v16.1.0.
Type ".help" for more information.
> async function fn() { import('fs') }
undefined
> fn()
fish: “node” terminated by signal SIGSEGV (Address boundary error)
$ node
Welcome to Node.js v16.1.0.
Type ".help" for more information.
> async function fn() { await import('fs') }
undefined
> fn()
fish: “node” terminated by signal SIGSEGV (Address boundary error)

Oddly enough it's sometimes ok? Once?

$ node
Welcome to Node.js v16.3.0.
Type ".help" for more information.
> async function fn() { await import('fs') }
undefined
> fn()
Promise { <pending> }
> fn()
fish: “node” terminated by signal SIGSEGV (Address boundary error)

It says Promise { <pending> } but it seems lucky?

How often does it reproduce? Is there a required condition?

Most of the time... I only have a Linux machine here so limited testing.

What is the expected behavior?

No SIGSEGV

What do you see instead?

SIGSEGV

Additional information

I tried looking up how to get a coredump, here's the closest I got:

$ npm i segfault-handler
$ node
Welcome to Node.js v16.1.0.
Type ".help" for more information.
> async function fn() { tt = await import('fs') }
undefined
> const SegfaultHandler = require('segfault-handler');
undefined
> SegfaultHandler.registerHandler('crash.log');
undefined
> fn()
PID 49713 received SIGSEGV for address: 0x10
/home/today/_/work/acorn-macros/node_modules/segfault-handler/build/Release/segfault-handler.node(+0x3785)[0x7f5e72cf1785]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x153c0)[0x7f5e729803c0]
node[0xa2dbb2]
node(_ZN2v88internal7Isolate38RunHostImportModuleDynamicallyCallbackENS0_6HandleINS0_6ScriptEEENS2_INS0_6ObjectEEENS0_11MaybeHandleIS5_EE+0xad)[0xe7a9bd]
node(_ZN2v88internal25Runtime_DynamicImportCallEiPmPNS0_7IsolateE+0xc8)[0x1237528]
node[0x160c794]
fish: “node” terminated by signal SIGSEGV (Address boundary error)
@Ayase-252
Copy link
Member

Duplicate of #38695?

@aduh95
Copy link
Contributor

aduh95 commented Jun 8, 2021

Duplicate of #38695?

Looks like it. @heyheyhello do you happen to have a folder with the name src in the directory you're working in?

@RaisinTen
Copy link
Contributor

RaisinTen commented Jun 8, 2021

@aduh95 I could reproduce this and also the code in #38695 on v16.0.0 without having to create any src directory in the current working directory.

@aduh95
Copy link
Contributor

aduh95 commented Jun 8, 2021

@aduh95 I could reproduce this and also the code in #38695 on v16.0.0 without having to create any src directory in the current working directory.

Ah it did seem indeed a bit superstitious to think it was part of the repro. Thanks for the confirmation.

Closing as duplicate.

@aduh95 aduh95 closed this as completed Jun 8, 2021
@aduh95 aduh95 added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Jun 8, 2021
@nettybun
Copy link
Author

nettybun commented Jun 8, 2021

Yeah there's no src directory :) Thanks everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

4 participants