Page MenuHomePhabricator

Add a test for the mempool dynamic memory usage
AbandonedPublic

Authored by Fabien on May 7 2020, 18:37.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

The mempool max size is determined by evaluating the mempool dynamic memory usage. This cause the behavior to change between various architectures that have different pointer sizes or different internal representations of the standard library structures. This diff adds a test for the mempool dynamic memory usage calculation, as a first step towards faking this calculation to make it architecture independent.

This test is only valid for glibc based 64 bits architectures for now, and skipped for others.
The goal is to move the mempool memory accounting in such a way that the test will pass on any target.

Test Plan
ninja check-bitcoin-mempool_tests

Diff Detail

Repository
rABC Bitcoin ABC
Branch
add_mempool_dynamic_usage_tests
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 10641
Build 19089: Default Diff Build & Tests
Build 19088: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.May 7 2020, 18:37
deadalnix requested changes to this revision.May 9 2020, 11:50
deadalnix added a subscriber: deadalnix.

Why is that a problem that the memory usage is computed in an architecture dependent manner? Isn't it architecture dependent?

This revision now requires changes to proceed.May 9 2020, 11:50
Fabien requested review of this revision.May 11 2020, 09:16
Fabien edited the summary of this revision. (Show Details)

The mempool dynamic memory usage is what is used to limit the number of transactions in the mempool (-maxmempool). This creates a disparity between 32 and 64 bits architectures because the memory usage is obviously architecture dependent.
I am trying to solve the issue you described in D5852, and in order to not break the API (-maxmempool) I need to fake the way the memory usage is evaluated by the mempool. This test is here to guarantee that the evaluation remains the same, so there is no change in behavior for the reference linux 64 arch, then after a few diffs it will demonstrate that the evaluation is now the same for all archs.
I updated the summary to make the intent more clear.

deadalnix requested changes to this revision.May 11 2020, 11:34

The mempool dynamic memory usage is what is used to limit the number of transactions in the mempool (-maxmempool).

Then maybe that is what is wrong. What if I want to actually know the memory consumption of the mempool?

This revision now requires changes to proceed.May 11 2020, 11:34
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.