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

set_ef causes Segmentation Fault #139

Open
louisabraham opened this issue Aug 18, 2019 · 2 comments
Open

set_ef causes Segmentation Fault #139

louisabraham opened this issue Aug 18, 2019 · 2 comments

Comments

@louisabraham
Copy link
Contributor

The following code segfaults:

import hnswlib

n_docs, dim = 7571305, 100

index = hnswlib.Index("l2", dim)
index.set_num_threads(16)
index.set_ef(10)

Python 3.7.1
hnswlib==0.3

I installed it yesterday from github with python3 setup.py install.

@louisabraham
Copy link
Contributor Author

louisabraham commented Aug 18, 2019

I think the index must be initialized before.

It is not clear what parameters are dumped with the index and what parameters must be reset.

As a side note, https://docs.python.org/3/library/faulthandler.html is super useful to diagnose segfaults!

@yurymalkov
Copy link
Member

Hi @louisabraham
Yes, the index has to be initialized first. There is no check for that - it should be fixed.

ef_ is not currently dumped with the index. I'll update the docs to reflect this.
It is a good idea to store the ef_ in the dumped index, but this needs an overhaul of the format to make it extendable and avoid such problems in the future.

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

2 participants