-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Hard crashes Node.js when a worker thread is terminated #193
Comments
Alas, at first glance, there are no solutions without consequences.
There is a Node-API switch called It is a compile-time option, so I cannot give you the possibility to set a runtime flag - By the way I highly recommend you to load |
😞 That does make sense, thank you for explaining. Would you be able to give me a little bit more info about that Node-API switch? Rebuilding pymport might be alright, in this specific case, since Storyteller is only distributed as a Docker container. I'm already building Thanks for the note about loading pymport into the main thread, that's a good call. In the actual production service, I'm using piscina, and I'm only using a single, persistent worker thread, so the worker module gets cached and startup and I believe only ends up getting loaded one time. |
--- a/src/pymport.h
+++ b/src/pymport.h
@@ -1,5 +1,6 @@
#pragma once
+#define NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS
#include <map>
#include <list>
#include <set> |
Thanks so much, I will give this a shot! I really appreciate it |
This is working perfectly; thanks again! |
As you have surely seen from my profile page, I am currently in a middle of a huge extortion involving the French police, corrupt judges, several big tech companies and many major open source projects. In order to intimidate me, people are posting simultaneously in my projects. |
Fixed by #330 |
Howdy! This is a great project! I've been using it to integrate Storyteller with the whisperx and fuzzysearch python libraries. It works very well in the general case, but:
Storyteller runs
pymport
from a Worker thread, via piscina. Piscina supports cancelling workers, and does so by callingworker.terminate()
. When this callsite is reached, if the Worker is running Python code, the Node.js runtime crashes with one of a few different C++ errors:OR
After which the entire Node.js runtime crashes, up through the parent process that kicked off the Piscina worker.
For what it's worth, https://github.com/hmenyus/node-calls-python, a similar project, has very similar issues.
Anyway, I don't even know if this is something you can resolve here, or if it's actually an issue with terminating worker threads while Node.js is running any addon code, but I figured I would give it a shot!
Here's a minimal reproduction, if that helps at all: https://github.com/smoores-dev/node-python-worker-repro
The text was updated successfully, but these errors were encountered: