-
Notifications
You must be signed in to change notification settings - Fork 60
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
Add lock to avoid segfault while resizing #61
Conversation
…o index-while-resizing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need to take a shared lock over resizeLock
when calling addPoint
? (addPoint
is reading the data structures that get mutated while calling resizeIndex
, and IIRC would also hit a segfault if we call addItems
in parallel with resizeIndex
.)
|
I think it's still definitely worth locking there too - there are cases where multiple concurrent calls to
|
👍 sounds good, will try to replicate in test and add the lock |
…o index-while-resizing
There is some unsafe memory access in the resizeIndex method, where it deletes and moves around memory while other threads may be accessing it. This PR adds a read-write lock to ensure that the
resizeIndex
function has exclusive access to the underlying resources when it needs to move the memory around