Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Remove getnettotals/getpeerinfo consistency test #20258

Merged
merged 1 commit into from
Oct 28, 2020

Conversation

jnewbery
Copy link
Contributor

We make no guarantees about consistency between RPC calls.

Alternative to 18784

We make no guarantees about consistency between RPC calls.
@maflcko
Copy link
Member

maflcko commented Oct 28, 2020

review ACK 778cd0d

@fanquake fanquake added the Tests label Oct 28, 2020
@jnewbery jnewbery changed the title [tests] Remove getnettotals/getpeerinfo consistency test tests: Remove getnettotals/getpeerinfo consistency test Oct 28, 2020
@troygiorshev
Copy link
Contributor

ACK 778cd0d after reading discussion on 18784, code review, ran test

@maflcko maflcko merged commit 3f512f3 into bitcoin:master Oct 28, 2020
@jnewbery jnewbery deleted the 2020-10-remove-net-totals-test branch October 28, 2020 15:53
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 28, 2020
…cy test

778cd0d [tests] Remove getnettotals/getpeerinfo consistency test (John Newbery)

Pull request description:

  We make no guarantees about consistency between RPC calls.

  Alternative to 18784

ACKs for top commit:
  MarcoFalke:
    review ACK 778cd0d
  troygiorshev:
    ACK 778cd0d after reading discussion on 18784, code review, ran test

Tree-SHA512: 438333a111cc93a09680cec47f13fbe03557d4803e5d826aec6f72e5afea62a088622645f0756e8fd2c9182c2a69ccca867d4d6fed2250364bee2b6c834adb1a
peer_info_after_ping = self.nodes[0].getpeerinfo()
for before, after in zip(peer_info, peer_info_after_ping):
peer_info_after = self.nodes[0].getpeerinfo()
for before, after in zip(peer_info_before, peer_info_after):
assert_greater_than_or_equal(after['bytesrecv_per_msg'].get('pong', 0), before['bytesrecv_per_msg'].get('pong', 0) + 32)
assert_greater_than_or_equal(after['bytessent_per_msg'].get('ping', 0), before['bytessent_per_msg'].get('ping', 0) + 32)
Copy link
Member

@maflcko maflcko Nov 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still assumes they are synchronised/consistent. the assert should be replaced by a wait_until. See #20299

deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 21, 2021
Summary:
[[bitcoin/bitcoin#20258 | core#20258]]:
> The `CNode` member `nSendBytes` is incremented under the node's lock `cs_vSend`. However, `RecordBytesSent` is not. An RPC thread that acquires the `cs_vSend` lock puts the message handler thread on hold. While the thread is on hold, `getnettotals` returns "stale" values or values that don't add up.
>
> We make no guarantees about consistency between RPC calls.

[[bitcoin/bitcoin#20299 | core#20299]]
> The test fails intermittently because getpeerinfo and getnettotals are not synchronised, so a wait_until is needed for each RPC (separately).

This is a backport of [[bitcoin/bitcoin#20258 | core#20258]] and [[bitcoin/bitcoin#20299 | core#20299]]

Test Plan: `test/functional/test_runner.py rpc_net.py`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10706
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants