-
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
Neon background task calls fail when run from the REPL if the domain module has been required #418
Comments
While working on #410, I noticed that there are warnings about deprecated |
What @apendleton did not mention is that this error causes the process to crash (happens with node v13.10.1 on macOS, v10.19.0 on macOS and v12.16.1 on Linux musl-libc). Worth adding, that for me this happens in REPL without
I can confirm that this is the cause. These changes in v8::Local<v8::Function> callback = v8::Local<v8::Function>::New(isolate_, callback_);
+ Nan::AsyncResource resource("nan:neon-task");
+ resource.runInAsyncScope(context->Global(), callback, 2, argv);
- node::MakeCallback(isolate_, context->Global(), callback, 2, argv);
callback_.Reset();
context_.Reset(); fixed the issue for me. I did not make a PR because |
Does the problem has been fixed? It seems it still exist when running Node as REPL mode. Test env:
|
It has been fixed, but there were no new releases since then. Here's a temporary solution from my Cargo.toml: [build-dependencies]
neon-build = { git = "https://github.com/neon-bindings/neon.git", rev = "20df99bedc13ee1bd7f4801a74920bd81ff099d7" }
[dependencies]
neon = { git = "https://github.com/neon-bindings/neon.git", rev = "20df99bedc13ee1bd7f4801a74920bd81ff099d7" } |
🤦 Sorry about that! We'll get a release out this week. |
Looks like the release has slipped? |
@That3Percent published. |
It appears that the following combination of things:
domain
module having been first requirednode -e
causes the callback to fail to be called, and instead, for a weird, inscrutable error to be produced:
To reproduce, create a new neon project and edit
src/lib.rs
to contain:and edit
lib/index.js
to contain:and then run it with
node -e "require('.')"
. Note:node .
works fine; just the REPL ornode -e
causes the failure mode. Likewise, if you comment out the requiring ofdomain
, it works when run either way. Sync functions are not affected, and the body of the async tasks runs; failure seems not to occur until we try to call the JS-side callback function.Other reports about the
domain.enter is not a function
seem to suggest that it's an issue that comes up when running Node 10 in combination with native addons built with NAN versions older than 2.10.0, but neon currently uses 2.10.0, and #410 (which updates to a newer NAN) seems not to fix the issue.The text was updated successfully, but these errors were encountered: