-
Notifications
You must be signed in to change notification settings - Fork 115
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
Possible issue shrinking BitBox #55
Comments
That's a really interesting cutoff number; I wonder what's up with that. Anyway, it's my bug and I know exactly why it happened. Can you check if current master, commit c5587f0, fixes it? |
That commit does not appear to have resolved the issue :
|
Neat. I really wish I knew how to run ASAN, or to have a way to be sure I understand what the |
From a sample size of one, I declare the problem wholly eliminated :
Is there a short version of why you think this works, or at least why the old code was wrong ? Thank you. I would close the issue, but perhaps you have your own process to follow. |
At first, I thought that my construction of a The second commit addresses a different fault: the allocator is not required to preserve the address when shrinking an allocation! The macOS allocator probably has an inclusive limit at 8064 words for its bucket size; the 8065-word vector, when shrinking, was moved to a smaller allocation and the large allocation was released back to the OS. Line 655 used the original address, not the result of If you unwind a commit, I bet attempting to manipulate the I'll close this when I release the Thank you for the report and the investigation! |
My current lack of nomicon-level Rust knowledge prevents me from completely assimilating the details of your explanation, but it remains plausible and soothing. Thanks for the quick turn-around. |
I learned how to run Miri, and ran it on 0.17.3 out of interest. For me, Miri finds the problem only if at least 65 bits are reserved (probably because More significantly, though, Miri finds the issue on my Linux virtual machine as well, where the issue had not previously manifested. Perhaps Miri could prove useful for vetting the whole of |
First, thank you for
bitvec
.I found a strange problem (freeing of unallocated memory) when shrinking a
BitVec
to aBitBox
, but I can reproduce it only on macos. I have a hunch the problem may not be inbitvec
at all, but possibly in something Rust-specific. Any guidance will be appreciated.I created a reproducible minimal testcase in kulp/bitvec-debugging. Github Actions shows failure on macos, whereas Ubuntu succeeds (the Windows job tends to be canceled because it does not finish before macos fails). On my Mac OS 10.14.6 machine, test failure (with bitvec 0.17.3) looks like this :
A backtrace from
malloc_error_break
showsalloc::raw_vec::shrink_to_fit
occurring duringcore::ptr::drop_in_place
. The dynamically-nearestbitvec
code is this :I wrote a script that demonstrates the problem exists across a broad swathe of Rust versions and
bitvec
versions. All x.0 versions of Rust from 1.36.0 through 1.42.0 and all x.0 versions ofbitvec
from 0.11.0 through 0.17.0 (and 0.17.3 as well) demonstrate the issue.For the real code in which this issue was first discovered, my only workaround is to switch to Linux, which is possible for the short term but rather worrying.
Do you think it plausible that this is a Rust compiler or library issue ? if so, can you suggest a plan of attack for chasing it down further, or reporting it elsewhere ?
The text was updated successfully, but these errors were encountered: