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
strange segfault's occur related to lmdb-rs #29
Comments
Simply reiterating comments from code-ape/lmdbrs_segfault#1: I suspect it may be an issue with how Vec's work in Rust. I don't know if this relates to heap vs stack operations and pointers but I suspect this is not an issue with mmapping as if it were the case then it would also fail for the pub fn into_vec<T>(mut b: Box<[T]>) -> Vec<T> {
unsafe {
let xs = Vec::from_raw_parts(b.as_mut_ptr(), b.len(), b.len());
mem::forget(b);
xs
}
} It appears that the use of Also upon examining docs for
It seems like the lifetime of the Vec may also have something to do with this issue, see here, where when the Vec goes out of scope all data related to it does as well. Maybe this could be fixed by casting to a slice and then converting to a |
thanks for the research! the pointer to the mailing list confirms my suspicion. either as i mentioned already in the pull request, i'd prefer dropping the |
I forked the repo and removed the |
hello @code-ape, the one way direction of the conversion is ok. i'd see it as a convenience, otherwise i'd have to pass in regarding your memory safety concern on
|
Actually, it should just copy as that's semantics of |
I apologize for a delay and I'll try to get some time tomorrow to fix it. |
@vhbit many thanks for the feedback. yes, making a copy of the data in it's just that i personally - as a client code programmer - prefer to see allocations explicitly ... however, thinking again about it, i agree that this can lead to more verbose client code. after all, it's the user's choice whether to |
Thank you for the fix Valerii! That was quite fast and works nicely! :) I added a test to cover this. |
I've encountered a rather bizarre segfault occurrence that is somehow linked to lmdb-rs. The segfault is odd and manifests in strangle places. In my project that I currently am experiencing issues with this it generally manifests when trying to transform data read from the db or move an
Arc
to the environment into a new thread. You can check out the code here.I created a repository purely for reference in helping solve this issue, which you can find here. I'm happy to help in fixing this if you can point me in the right direction. I've really enjoyed using this library and need it to work to complete my senior project.
The text was updated successfully, but these errors were encountered: