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

[1.29.x][regression] segfault when require()-ed from a worker thread in Node 22/Linux #892

Open
AviVahl opened this issue Jan 12, 2025 · 2 comments

Comments

@AviVahl
Copy link

AviVahl commented Jan 12, 2025

Reproduced locally (fedora 41/kernel 6.12.8/node 22.13.0) and on our Linux CI machines (ubuntu-based, I believe).

Steps to reproduce:

mkdir lightning-segfault
cd lightning-segfault
npm init -y
npm i lightningcss
echo "const { Worker } = require('worker_threads'); new Worker(require.resolve('./worker.cjs'));" > entry.cjs
echo "require('lightningcss')" > worker.cjs
node entry.cjs

1.28.x works
1.29.x prints Segmentation fault (core dumped) and crashes the process

Basic steps with GDB say:

Thread 13 "node" received signal SIGSEGV, Segmentation fault.

(gdb) backtrace
#0  0x00007fffce5a0ef0 in ?? ()
#1  0x00007ffff7a79e30 in __nptl_deallocate_tsd () from /lib64/libc.so.6
#2  0x00007ffff7a7cf02 in start_thread () from /lib64/libc.so.6
#3  0x00007ffff7b010cc in __clone3 () from /lib64/libc.so.6

not sure whether the above is useful without additional debug symbols.

@devongovett
Copy link
Member

Probably related to this Rust bug: rust-lang/rust#91979. The workaround is to load the native module on the main thread in addition to the worker so that it never gets unloaded.

@AviVahl
Copy link
Author

AviVahl commented Jan 13, 2025

Probably related to this Rust bug: rust-lang/rust#91979. The workaround is to load the native module on the main thread in addition to the worker so that it never gets unloaded.

Appreciate the workaround, even though it won't help our case. We've got code from "repo A" loading other pieces of code from a separate "repo B" without knowing B uses lightningcss in its logic or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants