-
Notifications
You must be signed in to change notification settings - Fork 286
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
Spawning worker threads (with native node add on) result in "Memory Access Error" (special capabilities are not inherited) #4395
Comments
Forget to mention, i used a patched version of "raw-socket", since it currently does not work in worker threads: nospaceships/node-raw-socket#89 diff --git a/src/raw.cc b/src/raw.cc
index b8e4850..b8f50e5 100644
--- a/src/raw.cc
+++ b/src/raw.cc
@@ -52,7 +52,9 @@ void InitAll (Local<Object> exports) {
SocketWrap::Init (exports);
}
-NODE_MODULE(raw, InitAll)
+// see #89
+//NODE_MODULE(raw, InitAll)
+NAN_MODULE_WORKER_ENABLED(raw, InitAll)
NAN_METHOD(CreateChecksum) {
Nan::HandleScope scope; Patched version: raw.node.tar.gz |
This means segmentation fault, right. Where is the error you mentioned in the title? |
Not sure what the exact translation is, but "Speicherzugriffsfehler" is loose translated to "Memory access error". I created a native add-on (to debug this issue) that prints the capabilities of the executable: https://stackoverflow.com/q/78496672/5781499 |
It seems there has been no activity on this issue for a while, and it is being closed in 30 days. If you believe this issue should remain open, please leave a comment. |
It seems there has been no activity on this issue for a while, and it is being closed. If you believe this issue should remain open, please leave a comment. |
Node.js Version
v20.11.0
NPM Version
v10.5.1
Operating System
Linux workstation 6.5.0-28-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 28 23:46:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
worker_threads
Description
Main thread, do not pass capabilities to worker threads.
Setted capabilities on the node.js executable:
E.g.:
Results in the worker who needs them in a "memory access error".
Minimal Reproduction
For the example above a the module "raw-socket" is used to create raw network sockets to send icmp ping messages.
When used used with the argument
--direct
the script creates directly a raw socket. Without it, it spawns a worker thread and trys to create the raw socket in the worker thread, which results in the error described above.Output
sudo /usr/bin/node test.js
sudo /usr/bin/node test.js --direct
Before You Submit
The text was updated successfully, but these errors were encountered: