Page MenuHomePhabricator

Fix memory access violation in tests
ClosedPublic

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

Details

Reviewers
deadalnix
jasonbcox
Group Reviewers
Restricted Project
Commits
rABC1b183e570175: Fix memory access violation in tests
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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Fabien created this revision.Fri, Jul 5, 20:43
Herald added a reviewer: Restricted Project. · View Herald TranscriptFri, Jul 5, 20:43
jasonbcox accepted this revision.Fri, Jul 5, 21:03
This revision is now accepted and ready to land.Fri, Jul 5, 21:03
This revision was automatically updated to reflect the committed changes.