-
Notifications
You must be signed in to change notification settings - Fork 465
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
ThreadSafeFunction
should handle exceptions in async callbacks identical to Node itself
#1119
Comments
Here is what I did: Ideally, I want to be able to call this: https://github.com/nodejs/node/blob/64cc066f59f50e29fc3a587a3cfc8b1270eb45cd/src/node_errors.cc#L856 |
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made. |
I believe this is addressed by the core pr: nodejs/node#36510 |
Discussed in the node-api team meeting and agreed it should be resolved by #36510 |
@mmomtchev can you check that #36510 which has landed in the primary branch resolved the issue for you |
No, I am impacted by this Line 2362 in 63d3c30
|
@mhdawson This is a problem because after #36510 the only possible fix is to leave the exception handling in |
In fact, I think that the fundamental problem is that #36510 is an API-breaking PR that requires a |
@mmomtchev right now the new behavior should be off by default see - nodejs/node#36510 (comment). Is that not the case? We should be able to check the flag in node-api (I think) and use that to choose how to handle the exception. It's possible we still need a chagne on the node-addon-api side to do this though. (ie if flag is set to do the right thing) Am I missing something? |
If you can check for this flag while remaining backwards compatible, sure, this can be a solution. Still, it will be somewhat problematic for the end user (the module author) - is it up to him to check for raised exceptions or not - as there will be two possibilities within the same version number. But since it is possible to easily handle both, it might stay like this. Currently a module that calls a |
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made. |
Next steps:
|
@legendecas will look at:
|
I believe nodejs/node#36510 can handle the uncaught exceptions in async callbacks. However, as the flag requires the user to explicitly opt-in, the solution might not be optimal for library authors. Library authors now can still emit an As a follow-up, we'll investigate how to help add-ons to migrate to expected runtime behavior, without any breakages, like the flags that are being worked at nodejs/node#42557 (comment). |
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made. |
This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made. |
This is a duplicate of #669
When a JS callback called from a
ThreadSafeFunction
throws an exception, the result is:While this:
ends up like this:
Why is it such a big deal? Because, as a module author, the first one will surely end up in an issue for my module, while with the second one, the user will correctly recognize what is happening.
Ideally, there should be a way to call Node's internal method which terminates the process.
The text was updated successfully, but these errors were encountered: