Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Segfault with simple stress test of global allocator #36
The following simple stress test fails rapidly with a segfault:
I have attempted to debug this a bit. What I have found is that in GlobalHeap::pageAlignedAlloc() I will see that the pointer returned from mh->mallocAt() == arenaBegin(), and if I check miniheapForLocked(ptr) it does not point to the original miniheap. When I later free this allocation it fails due to the same bogus miniheap pointer being found in ThreadLocalHeap::free(). Unfortunately I have not yet been able to diagnose further.
This error does not occur if I allocate fixed size objects; having some randomness in the allocation size seems to be required to trigger the issue.
(minor sidebar: what is the "locked" implied in miniheapForLocked()? free() calls it with no obvious locks held? A comment and/or renaming of the function might help.)
Going to have to continue this tomorrow, but again thanks for such a helpful test case + debugging notes.
I've built mesh locally with
There are at least 2 things going on here: we aren't properly coalescing/reusing dirty
Second, this error happens right around when the new allocation is 4 GiB from the start of the arena -- it sure feels like we have some