-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
segfault when using SharedArrayBuffer from an unrefed worker thread #28777
Labels
Comments
3 tasks
Thank you for the excellent reproduction! #28788 should address this. |
Thanks for the quick fix! |
addaleax
added a commit
to addaleax/node
that referenced
this issue
Jul 21, 2019
Use the parent thread’s `ArrayBuffer::Allocator` when creating a Worker instance, as that allocator is guaranteed to outlive the Worker itself. This requires making the zero-fill flag a thread_local variable in order to avoid race conditions between different threads. A test for that behaviour is added as well. Fixes: nodejs#28777 Fixes: nodejs#28773
addaleax
added a commit
to addaleax/node
that referenced
this issue
Aug 17, 2019
Keep a reference to the `ArrayBuffer::Allocator` alive for at least as long as a `SharedArrayBuffer` allocated by it lives. Refs: nodejs#28788 Fixes: nodejs#28777 Fixes: nodejs#28773
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The following code causes a segfault:
The segfault occurs due to usage of
unref()
on the worker. Without that call, the process exits as normal (whenprocess.exit()
is called from within themessage
handler, otherwise it keeps running).Backtrace from lldb:
The cause (within node) appears to be in the destructor of
SharedArrayBufferMetadata
:node/src/sharedarraybuffer_metadata.cc
Lines 120 to 124 in b6bfc19
Possibly this is a race between the main thread and worker thread, but I'm not familiar enough with node's internals to debug further.
The text was updated successfully, but these errors were encountered: