Skip to content
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

Segmentation fault #18

Closed
ghost opened this issue Apr 30, 2022 · 4 comments
Closed

Segmentation fault #18

ghost opened this issue Apr 30, 2022 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 30, 2022

Thanks a lot for making this library!

(I know this is a binding to the c++ library)

Is there any limit on the vector length ?

Having the same exact example with a doubled length like:

annoyIndex1.addItem(0, [-5.0, -4.5, -3.2, -2.8, -2.1, -1.5, -0.34, 0, 3.7, 6, -4.5, -3.2, -2.8, -2.1, -1.5, -0.34, 0, 3.7, 6]);
annoyIndex1.addItem(1, [5.0, 4.5, 3.2, 2.8, 2.1, 1.5, 0.34, 0, -3.7, -6, 4.5, 3.2, 2.8, 2.1, 1.5, 0.34, 0, -3.7, -6]);
annoyIndex1.addItem(2, [0, 0, 0, 0, 0, -1, -1, -0.2, 0.1, 0.8, 0, 0, 0, 0, -1, -1, -0.2, 0.1, 0.8]);

results in

*** stack smashing detected ***: terminated
Aborted (core dumped)

and in my example with length equals 300 (big embedding), I'm having:

Segmentation fault (core dumped)

and when lowering the length to exactly 19 elements, it works fine !! with an index of 50000 elements and beyond !

Thanks a lot !!!

@ghost
Copy link
Author

ghost commented Apr 30, 2022

If I feed the index with vectors of type Float64Array, it feeds the index (like without visible errors) but then the index is corrupt like:

var v1 = annoy.getItem(0);
var v2 = annoy.getItem(1);
console.log('Gotten vectors:', v1, v2);

Gotten vectors: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]

@ghost
Copy link
Author

ghost commented Apr 30, 2022

Some are talking about a protection to disable (related to these problems) A flag for c++ compilation could be passed

-fno-stack-protector (g++ is used for compilation here instead).

@ghost
Copy link
Author

ghost commented May 4, 2022

Following my last attempt passing the compiler tag, it doesn't work

https://github.com/bacloud22/annoy-node

Waiting for a solution 🥲

@ghost
Copy link
Author

ghost commented May 4, 2022

Oh I forgot to mention that I'm running on a Ubuntu VM on windows. So this might cause problem allocation errors. I would try on a real Linux next days...

@ghost ghost closed this as completed May 6, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants