[leap5] in undo tests, create undo_index
in CB memory segment and remove removed_nodes_tracker
#36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Creating the
undo_index
on the stack (solely done in the undo tests) ultimately causes the index to contain a mixture of stack allocated and shared-memory allocated objects. Unfortunately I don't have an exact proof of how this happens but debugging through the structure'snode_ptr
s makes it quite clear it's occurring.On Linux this typically is not a problem because the stack and shared-memory region tend to be very close to each other due to the implementation detail of where the
mmap()
is placed. However, on macOS,mmap()
s get fulfilled from the "other direction": the stack will be at a high address where themmap()
will be placed at a very low address. This breaks the new compressednode_ptr
structures and causes the test to crash.It's possible to simulate this on Linux by forcing the chainbase shared memory to be located further away from the stack by gobbling up some VM space early, for example, just this line below and then run a simple test like the
test_insert_fail
will also crash on Linux.Placing the
undo_index
s in the shared memory region avoids the creation of mixednode_ptr
s.Unfortunately there still remains a similar issue in
removed_nodes_tracker
. I was unable to rectify this. But...removed_nodes_tracker
is only used for a couple tests. I cannot find any harm in simply removing it?fwiw a run on Leap with this branch is at,
https://github.com/AntelopeIO/leap/actions/runs/7493988034
as more clear evidence the removed code is unused.