Page MenuHomePhabricator

Add a test for the mempool dynamic memory usage
Needs RevisionPublic

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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 10641
Build 19089: Default Diff Build & Tests
Build 19088: arc lint + arc unit

Event Timeline

Fabien created this revision.May 7 2020, 18:37
Herald added a reviewer: Restricted Project. · View Herald TranscriptMay 7 2020, 18:37
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
teamcity added a comment.Tue, Jun 9, 08:15
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.
Fabien awarded a token.Wed, Jun 10, 08:09
Fabien rescinded a token.
Fabien awarded a token.Wed, Jun 10, 08:17
Fabien updated a token.
Fabien rescinded a token.Wed, Jun 10, 08:20
Fabien awarded a token.Wed, Jun 10, 08:38
Fabien rescinded a token.Wed, Jun 10, 09:31
Fabien awarded a token.Wed, Jun 10, 10:38
Fabien rescinded a token.Wed, Jun 10, 13:04