-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
WorkerThreads: Cannot create a handle without a HandleScope #1981
Comments
We don’t yet support running in workers.
On Fri, Nov 8, 2019 at 6:57 AM meisterlampe ***@***.***> wrote:
Summary of Problem
-
What are you trying to do?
I want to open a serial connection from within a WorkerThread.
Maybe I'm using this wrong, any hint how to do it right is much
appreciated :-)
-
What happens?
I get this Error:
FATAL ERROR: HandleScope::HandleScope Entering the V8 API without proper locking in place
1: 0x9d8da0 node::Abort() [node]
2: 0x9d9f56 node::OnFatalError(char const*, char const*) [node]
3: 0xb37b8a v8::Utils::ReportApiFailure(char const*, char const*) [node]
4: 0xb3910e v8::HandleScope::HandleScope(v8::Isolate*) [node]
5: 0x9498ae node::InternalCallbackScope::InternalCallbackScope(node::Environment*, v8::Local<v8::Object>, node::async_context const&, node::InternalCallbackScope::ResourceExpectation) [node]
6: 0x94a7c5 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [node]
7: 0x7fd0a4c6c042 EIO_AfterOpen(uv_work_s*) ***@***.***/bindings/build/Release/bindings.node]
8: 0x12cfdd5 [node]
9: 0x12d42d1 [node]
10: 0x12e66a8 [node]
11: 0x12d4c5b uv_run [node]
12: 0xa1afa7 node::NodeMainInstance::Run() [node]
13: 0x9ab298 node::Start(int, char**) [node]
14: 0x7fd0a7a9db97 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
15: 0x949035 [node]
Aborted (core dumped)
- What should have happened?
SerialPort should work as normal.
Code to Reproduce the Issue
Minimal reproduction, that leads to the error:
const { Worker } = require('worker_threads');
const worker = new Worker(
`new require("serialport")("/dev/ttyUSB0");`,
{ eval: true }
);
Running the same new outside the worker works fine:
const { Worker } = require('worker_threads');new require("serialport")("/dev/ttyUSB0");
Also requiring another library (tried moment here) works as expected:
const { Worker } = require('worker_threads');
const worker = new Worker(
`console.log((new require("moment"))().toISOString());`,
{ eval: true }
);
Versions, Operating System and Hardware
- ***@***.***
- Node.js v12.13.0
- Linux (Xubuntu 18.04)
Could this be related to some child-thread serialport is trying to start?
Please help :-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1981?email_source=notifications&email_token=AAAGK3VGCMUDNL5Y25IRV63QSVH3TA5CNFSM4JKWK7XKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HX6GQAQ>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAGK3QBD2ZCG42T7G7FUZLQSVH3TANCNFSM4JKWK7XA>
.
--
---
Francis Gulotta
[email protected]
|
Thank you for your fast answer. |
Quite a bit of c++ work has to be done to make it happen. Basically we need
to port to NAPI. A few people have started to work on it but we haven’t
landed any work towards that end.
On Sat, Nov 9, 2019 at 1:09 PM meisterlampe ***@***.***> wrote:
Thank you for your fast answer.
Is support possible/planned?
Any hints what has to be implemented to make it work?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1981?email_source=notifications&email_token=AAAGK3SJLSGHH3KTBPZSUA3QS34GDA5CNFSM4JKWK7XKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDULZUY#issuecomment-552123603>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAGK3XPURE25AHSMGSS6GLQS34GDANCNFSM4JKWK7XA>
.
--
---
Francis Gulotta
[email protected]
|
OK. Thanks for the good answers and of course for this lib too. I guess I can close this question. :) |
Actually looking at the previous tickets here, we need some c++ hooks and
maybe it’s an easier change than porting from NAN to N-API.
On Sat, Nov 9, 2019 at 1:57 PM meisterlampe ***@***.***> wrote:
OK. Thanks for the good answers and of course for this lib too. I guess I
can close this question. :)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1981?email_source=notifications&email_token=AAAGK3X76L5ZMAXHK42QNR3QS4BY3A5CNFSM4JKWK7XKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDUMWYI#issuecomment-552127329>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAGK3STTXZLIKI22YIPDGTQS4BY3ANCNFSM4JKWK7XA>
.
--
---
Francis Gulotta
[email protected]
|
Does the addon need to be "context aware" as described in here https://nodejs.org/api/addons.html#addons_context_aware_addons ? |
It’s the cleanup hooks |
Really looks easier than porting from nan to n-api (at least the description is shorter :-D ). |
Summary of Problem
What are you trying to do?
I want to open a serial connection from within a WorkerThread.
Maybe I'm using this wrong, any hint how to do it right is much appreciated :-)
What happens?
I get this Error:
SerialPort should work as normal.
Code to Reproduce the Issue
Minimal reproduction, that leads to the error:
Running the same new outside the worker works fine:
Also requiring another library (tried moment here) works as expected:
Versions, Operating System and Hardware
Could this be related to some child-thread serialport is trying to start?
Please help :-)
The text was updated successfully, but these errors were encountered: