-
Notifications
You must be signed in to change notification settings - Fork 27
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
Segmentation Fault immediately on require inside Worker threads on Linux #452
Comments
This is the thread local storage crash issue mentioned near the bottom of this: aws/aws-iot-device-sdk-js-v2#360 Current plan is to push through the linked s2n patches and switch from aws-lc to openssl's libcrypto which doesn't have a thread local storage destruction problem. I don't have an ETA atm. |
We have exactly the same problem currently which is blocking us from upgrading from aws-sdk v2 -> v3. Hopefully we get a fix soon 🙏 |
Same issue reproduced, when running node 17.7 on ARM64 using |
+1 🙏 this has been very vexing for our team! Thank you for investigating! This has broken our AWS-CDK build process. |
https://github.com/awslabs/aws-crt-nodejs/releases/tag/v1.15.19 should fix this crash. We will update the v2 IOT SDK for Javascript shortly. For other dependency updates, please contact the maintainer of the package directly. |
Can confirm that it fixed the crash in both my minimal repro & our test setup with aws-sdk-js-v3, and for aws-sdk-js-v3 packages, at least on version Thank you 👍 |
Describe the bug
When using Node.js Worker threads,
Segmentation fault (core dumped)
/SIGSEGV
is triggered whenaws-crt
is imported/loaded, or more specifically: when the native binary is launched.For me, this first appeared after upgrading a project to AWS SDK JS v3 and a test case run via
ava
(using Worker threads) started segfaulting immediately when a module that invokednew FirehoseClient({})
was imported (which in turn, imports/usesaws-crt
).Expected Behavior
Expected
aws-crt
to either throw the exception implemented in #290 or just work when using Worker threads (based on #451 but I might be misunderstanding).Ideally, I'd be able to run tests using
aws-crt
concurrently withava
(using Worker threads).Current Behavior
Immediate
Segmentation fault (core dumped)
uponrequire('aws-crt')
(or equivalent).As I'm not too familiar with debugging C(++), my debugging attempts probably contain a lot of red herrings but here are some of my attempts/findings so far:
Using llnode (
lldb
plugin), the backtrace of the minimal repro at least looks weird:Trying to run the binary directly with
lldb
, crashes withSIGSEGV: address access protected
:Reproduction Steps
I've been trying to identify the meaningful variables but at least the most reproducible example is (based on #286 (comment)):
Start an EC2 instance with AMI
al2023-ami-2023.0.20230503.0-kernel-6.1-x86_64
(latest Amazon Linux 2023 HVM at the time of writing)On the host, install Node.js:
yum install nodejs
(from the built-in repos, it's18.12.1
at the time of writing)Core dumps:
ulimit -c unlimited
Create repro files and run:
aws-crt
from source and requiredaws-crt-nodejs/dist/index.js
(or thelinux-x64
binary directly in CommonJS)Possible Solution
No response
Additional Information/Context
If I'm not mistaken about
aws-crt
being supposed to work under Worker threads, I guess this is actually an upstream Node.js issue but as mentioned, I'm not really familiar enough with C(++) stuff and Worker threads so I haven't been able to confirm.Here's all the setups I've been able to reproduce this with:
Versions of
aws-crt
:1.15.9
1.15.16
Node.js:
16.19.1
18.16.0
18.12.1
Operating systems:
amazonlinux:2
, running on an Ubuntu-based hostLinux hostname 5.15.0-1033-aws #37~20.04.1-Ubuntu SMP Fri Mar 17 11:39:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Linux hostname 5.15.82-0-virt #1-Alpine SMP Mon, 12 Dec 2022 09:15:17 +0000 x86_64 x86_64 x86_64 GNU/Linux
Linux hostname 6.2.13-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 27 01:33:30 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Linux hostname 6.1.25-37.47.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Apr 24 23:20:16 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
ava
setup works with Worker threads enabled if I just use thedarwin-x64
binary on Linux (cp -a node_modules/aws-crt/dist/bin/darwin-x64/aws-crt-nodejs.node node_modules/aws-crt/dist/bin/linux-x64/aws-crt-nodejs.node
)Memory:
Other:
glibc
etc. versions for all the cases (especially as I'm unfamiliar with C(++) tooling and what exactly would be relevant), but at least for the minimal repro case below, the version is2.34
(from Amazon Linux 2023 repos)aws-crt-nodejs version used
1.15.16
nodejs version used
18.12.1
Operating System and version
Amazon Linux 2023, AMI:
al2023-ami-2023.0.20230503.0-kernel-6.1-x86_64
,uname -a
:Linux hostname 6.1.25-37.47.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Apr 24 23:20:16 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: