-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
Crash when used with worker threads #1365
Comments
I'm using threads.js with sqlite3 (through knex) inside a worker thread and it's working fine for me so far. |
I came across the issue on FreeBSD when running an application that uses worker threads, which worked fine on my Mac. I had to put the |
The code above crashes on my macOS development system. The issue is the following
Static data like this is not supported in a multi-threaded environment Multi-threaded support is a fairly recent addition to N-API. I've been able to address this issue on my development system using the These API calls are are implemented in N-APi version 6 and available in Node.js v10.20.0+, v12.8.0+, and v14.0.0+. They are still marked as experimental in the N-API documentation but I've been able to access them without the |
The following code will crash:
Trace:
The culprit seems to be the
HasInstance
method ofDatabase
which is called inStatement::Statement
. The constructor that it's checking against isn't context-specific. The issue is fixed when theHasInstance
check is removed. I'm not sure how it can be replaced with a context-aware version.@jschlight
The text was updated successfully, but these errors were encountered: