Skip to content

pytest: make the gossip CPU throttle tests independent of machine speed - #47

Merged
kwsantiago merged 5 commits into
blake2b-unifiedfrom
gossip-cpu-throttle-tests
Oct 18, 2026
Merged

kwsantiago merged 5 commits into
blake2b-unifiedfrom
gossip-cpu-throttle-tests

Conversation

@kwsantiago

Copy link
Copy Markdown

test_gossip_query_channel_range_cpu_throttle and test_gossip_throttle_no_unrequested_stream intermittently fail in CI with Unable to find "Throttling outgoing peer .*: too much CPU". Both relied on ten walks of a 15000 channel gossip store exceeding --dev-throttle-gossip's CPU budget, so on a fast runner with an optimized build the throttle never triggered.

  • Backports upstream's --dev-gossip-cpu-budget, which sets only the CPU budget for answering gossip queries and leaves the traffic limits alone, and its test that ordinary messages don't count against that budget. That test was added upstream as an expected failure ahead of the fix, which this tree already has, so the marker is removed here.
  • test_gossip_query_channel_range_cpu_throttle uses --dev-gossip-cpu-budget=10 instead of --dev-throttle-gossip, so one walk exceeds the budget on any machine and only CPU can throttle.
  • test_gossip_throttle_no_unrequested_stream needs a throttle that ends quickly, which a tiny CPU budget doesn't give (the wait grows with the overage). It now throttles by traffic: a 300 channel store, whose full range reply is over --dev-throttle-gossip's 1000 bytes a second.

With a 1500 channel store, so that a walk costs little, the old versions of both tests fail every run with the error CI shows (4/4) and the new ones pass (6/6); with the full stores they pass 20/20.

Changelog-None

nGoline and others added 5 commits October 17, 2026 17:34
--dev-throttle-gossip shrinks the traffic limits along with the CPU
budget, so a test can't tell which one throttled a peer.  This sets
only the total CPU budget for answering gossip queries (in usec per
second), leaving the traffic limits alone.

Changelog-None

(cherry picked from commit 1390018)
The CPU throttle charges every message connectd handles locally: pings,
pongs, onion messages, custom messages and gossip forwarded to gossipd,
not only the gossip queries it exists to bound.  The per-peer share is
the budget divided by the number of connected peers, so on a busy node
ordinary traffic exhausts it and we stop reading from the peer.

Changelog-None

(cherry picked from commit 9c617d7)
@kwsantiago
kwsantiago merged commit a851ff1 into blake2b-unified Oct 18, 2026
46 checks passed
@kwsantiago
kwsantiago deleted the gossip-cpu-throttle-tests branch October 18, 2026 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants