Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Calling async API from node worker threads results in errors #21

Open
devongovett opened this issue Feb 18, 2020 · 4 comments
Open

Calling async API from node worker threads results in errors #21

devongovett opened this issue Feb 18, 2020 · 4 comments

Comments

@devongovett
Copy link

Calling e.g. swc.parse from inside a node worker thread results in errors like the following:

FATAL ERROR: HandleScope::HandleScope Entering the V8 API without proper locking in place

This is likely due to calling the callback on the wrong thread, or with the wrong napi environment. I'm not familiar with Rust so I'm not sure where to debug further, but that's been my experience in C++.

@kdy1
Copy link
Member

kdy1 commented Feb 18, 2020

I think neon does not support the case.
I filed an issue on neon.

neon-bindings/neon#489

@dherman
Copy link

dherman commented Feb 28, 2020

Is this use case actually using any of the Neon async/threading APIs (including the new experimental one), or is it just simply calling regular Neon functions from within a Node worker that fails? I'm guessing it's the latter, and there may be something straightforward we've got wrong in order to support running Neon code in Node workers. But I want to make sure I know your use case before we fix the wrong thing.

@amilajack
Copy link

Hey @devongovett! Would love if you could add a small test case that reproduces this to neon-bindings/neon#489.

@kdy1
Copy link
Member

kdy1 commented Feb 29, 2020

@dherman My usecase includes Task api. Also, although it's not used now, I need to call EventHandler from Task.

I'm not sure about node js worker threads.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants