Skip to content

5.8mb contents of obfuscated wasm module printed when exception thrown elsewhere in program #43462

Description

@dvtate

Version

v18.3.0

Platform

Linux archbook 5.18.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 09 Jun 2022 16:14:10 +0000 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Please see this issue thread: emscripten-core/emscripten#17228

A realistic example is done as follows:

$ echo "{}" > package.json
$ npm install binaryen
$ cat > test.mjs
// Appears to be imported in a new thread?
import binaryen from 'binaryen';

// Never seen
console.warn('important debugging message!!');

throw new Error('fatal');

$ node test.mjs
important debugging message!!
[... 5.8 mb contents of node_modules/binaryen/index.js output to stderr ...]
[ 6 new lines ]
Error: fatal
    at file:///home/tate/Desktop/emscr-bug/test.mjs:7:7

Node.js v18.3.0
$ 

image

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

Consistently reproducable. I even remember experienceing this exact bug as far back as 2020 (nodejs v14+)

What is the expected behavior?

I'm assuming that it's importing the module concurrently with the main thread if that's the case than on error only the thread that errored should have it's code highlighted, or at least the code highlighted code should be truncated to where it doesn't take several seconds to print

What do you see instead?

5.8mb of obfuscated javascript which burries the debugging message I had written

Additional information

Relevant thread: emscripten-core/emscripten#17228

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    errorsIssues and PRs related to JavaScript errors originating in Node.js core.wontfixIssues that will not be fixed.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions