nodejs / node-addon-api Public
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
The Napi::Object class returns unstable results #699
Comments
|
Hi @younesZdDz , Not really sure... Are you using multiple threads? If so, |
|
Hello @KevinEady, yes |
|
Weeeird @younesZdDz , do you have some replicable test case we can see? Or something that describes the data you are passing to |
|
@KevinEady I will prepare a github repo with all the code and data used and provide the link here. |
|
@younesZdDz please re-open when you've had a chance to create a scenario that reproduces the issue! |


I am currently writing a c++ library that will be consumed by nodeJs using node-addon-api. The library has a function that takes a javascript object as input of this format :
The library parses the input into c++ classes using Napi::Object finds the nclosest vehicle for each rider based on haversine formula and remove distant vehicles from the list, so the output is an object created also using Napi::Object and has the same format. The code for the parser from Js Object is as follows:
And the code of the parser to Js object is:
And the library method is as follows :
The problem is when i run the code the results for larger instance are often correct, but sometimes i get an unpredictable results, for example i get as a result a number or corrupted string instead of the object created. Any suggestions on what's causing this unpredictable behaviour.
The text was updated successfully, but these errors were encountered: