Skip to content

Segmentation fault when executing worker with eval: true containing dynamic import after await #43205

@sapphi-red

Description

@sapphi-red

Version

v16.15.0

Platform

Microsoft Windows NT 10.0.19044.0 x64 / WSL: Linux PC 4.4.0-19041-Microsoft #1237-Microsoft Sat Sep 11 14:32:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

  1. Download https://gist.github.com/sapphi-red/a0179b52ebd3b6a19f51743594810ecf
  2. Run node eval_cjs.mjs. It exits with non-0 exit code.
    a. On windows, it does not show any error messages. The output of echo $LASTEXITCODE is -1073741819.
    b. On WSL (Ubuntu), it shows Segmentation fault (core dumped). The output of echo $? is 139.
  3. Run node eval_cjs_cjs.cjs. It exits with non-0 exit code same with eval_cjs.mjs.
  4. Run noneval_cjs.mjs. It finishes without any errors.
  5. Run noneval_mjs.mjs. It finishes without any errors.

The difference between the files are:

filename parent script worker script is eval result
eval_cjs.mjs ESM CJS O fail
eval_cjs_cjs.cjs CJS CJS O fail
noneval_cjs.mjs ESM CJS X success
noneval_mjs.mjs ESM ESM X success

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

It reproduces every time on my machine. const startAt = Date.now() + 10 * 1000 might differ between machines.

I suppose at least it needs to meet the following condition:

  • worker is created with eval: true
  • dynamic import is called after await

I am not sure why it requires 10 seconds delay.

What is the expected behavior?

Segmentation fault not happening.

What do you see instead?

Segmentation fault is happening.

Additional information

context: I was tring to fix vitejs/vite#8049 (comment). (FailureMessage one is not related to this.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy