Page MenuHomePhabricator

Fix memory access violation in tests
ClosedPublic

Authored by Fabien on Jul 5 2019, 20:43.

Details

Summary

Fix the memory access violations, such as:

unknown location(0): fatal error: in "wallet_tests/rescan": memory
access violation at address: 0x0000001f: no mapping at fault address
../src/wallet/test/wallet_tests.cpp(34): last checkpoint: "rescan"
fixture ctor

*** 1 failure is detected in the test module "Bitcoin Test Suite"
test_bitcoin:
/usr/include/boost/thread/pthread/condition_variable_fwd.hpp:116:
boost::condition_variable::~condition_variable(): Assertion `!ret'
failed.
Aborted (core dumped)

~TestingSetup calls UnloadBlockIndex() which deletes the
mapBlockIndex but does not reset the pindexBestForkTip and
pindexBestForkBase pointers. When a test then calls
ProcessNewBlock() (such as validation_block_tests), the callstack
leads to the CheckForkWarningConditions() where these pointers are
read, causing the fault.

Test Plan

Should never fail:

for i in {1..100}
do
    # This combination is known to exhibit the issue frequently
    ./src/test/test_bitcoin -t validation_block_tests,wallet_tests
done

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision is now accepted and ready to land.Jul 5 2019, 21:03
This revision was automatically updated to reflect the committed changes.