test: drop flaky "server too slow" check from interface_http.py #36848

Manually merged
pinheadmz merged 1 commit from interface-http-flake into master 2026-11-16 11:30:10 +00:00 AGit
pinheadmz commented 2026-11-12 19:02:51 +00:00 (Migrated from github.com)

Closes https://github.com/bitcoin/bitcoin/issues/36755

To cover -rpcservertimeout behavior our test expected the Bitcoin Core HTTP server to disconnect the test framework client after the configured duration but also before a somewhat arbitrary upper bound. This was helpful during development of #35182 but has led to false negatives in CI on platforms that are just plain slow.

Solve the flakiness by simply deleting the test case. Note that a regression is still caught by both the functional test and unit test suite. #36159 added a mock clock in the unit test to assert the disconnect timing. A server with no timeout would also fail the functional test which will time out during sock.recv() waiting for the EOF.

Both regression test failures can be observed on top of this branch by disabling rpcservertimeout:

diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 069eace507..7a090c4ca8 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -1205,7 +1205,7 @@ bool HTTPRemoteClient::ShouldDisconnect(MockableSteadyClock::time_point now, std
                  "HTTP client idle timeout %s (id=%llu)",
                  m_origin,
                  m_id);
-        return true;
+        return false;
     // Disconnect this client because the server is shutting down and we need to
     // disconnect all clients... Unless the client is still being handled by a
     // worker thread, in which case we'd rather continue the I/O loop (but might

Closes https://github.com/bitcoin/bitcoin/issues/36755 To cover `-rpcservertimeout` behavior our test expected the Bitcoin Core HTTP server to disconnect the test framework client after the configured duration but also *before* a somewhat arbitrary upper bound. This was helpful during development of #35182 but has led to false negatives in CI on platforms that are just plain slow. Solve the flakiness by simply deleting the test case. Note that a regression is still caught by both the functional test and unit test suite. #36159 added a mock clock in the unit test to assert the disconnect timing. A server with no timeout would also fail the functional test which will time out during `sock.recv()` waiting for the EOF. Both regression test failures can be observed on top of this branch by disabling rpcservertimeout: ```diff diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 069eace507..7a090c4ca8 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -1205,7 +1205,7 @@ bool HTTPRemoteClient::ShouldDisconnect(MockableSteadyClock::time_point now, std "HTTP client idle timeout %s (id=%llu)", m_origin, m_id); - return true; + return false; // Disconnect this client because the server is shutting down and we need to // disconnect all clients... Unless the client is still being handled by a // worker thread, in which case we'd rather continue the I/O loop (but might ```
DrahtBot commented 2026-11-12 19:03:01 +00:00 (Migrated from github.com)

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK maflcko, Pranav-error

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

LLM Linter (✨ experimental)

Possible places where comparison-specific test macros should replace generic comparisons:

  • test/functional/interface_http.py: assert duration >= seconds - 1 → Prefer assert_greater_than_or_equal(duration, seconds - 1).

2026-11-12 19:03:09

<!--e57a25ab6845829454e8d69fc972939a--> The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. <!--006a51241073e994b41acfe9ec718e94--> ### External sites * Code coverage & benchmarks: https://corecheck.dev/bitcoin/bitcoin/pulls/36848 * Ralph review <img src=https://review.fish.foo/assets/bitcoin/bitcoin/36848.png alt="Ralph review status"> https://git.fish.foo/bitcoin/bitcoin/pulls/36848#author-ralph <!--021abf342d371248e50ceaed478a90ca--> ### Reviews See [the guideline](https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#code-review) and [AI policy](https://github.com/bitcoin/bitcoin/blob/master/doc/AI_POLICY.md) for information on the review process. | Type | Reviewers | | ---- | --------- | | ACK | [maflcko](https://github.com/bitcoin/bitcoin/pull/36848#issuecomment-6853769519), [Pranav-error](https://github.com/bitcoin/bitcoin/pull/36848#issuecomment-6909399198) | If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore. <!--5faf32d7da4f0f540f40219e4f7537a3--> ### LLM Linter (✨ experimental) Possible places where comparison-specific test macros should replace generic comparisons: - `test/functional/interface_http.py`: `assert duration >= seconds - 1` → Prefer `assert_greater_than_or_equal(duration, seconds - 1)`. <sup>2026-11-12 19:03:09</sup>
First-time contributor

🔵 Suggestion · Idle-timeout coverage no longer distinguishes the configured value from the default

Removing the upper bound lets the idle-timeout assertions accept a 30-second default instead of the configured two seconds; the mock-clock tests do not cover that integration, although the current production path is correct.

Location: test/functional/interface_http.py:101 (head).

Review coverage was incomplete.


Reviewed: 75a23e7d36af · Review report · Previous reports

permalink

<!-- forgejo-review-bot:bitcoin/bitcoin --> <!-- ralph-engine:current:464886e574fc96b3587e582688c29b6bd7a73bba755cfc1d2f031cc648c7ec97:96b11b060163162106723c3b6f684428792dfa28110bbde7f4860e10f0618f25 --> <!-- ralph-base:8b0b5775ab72766cc0d3c77a483b22b41c542951 --> <!-- ralph-head:75a23e7d36afbbcfedef11bca94967b88bf40de0 --> <!-- ralph-case:0b78272efcc2708f5b13441b5e75b332de1173aed4482c6756568441e713d5a6 --> **🔵 Suggestion · Idle-timeout coverage no longer distinguishes the configured value from the default** Removing the upper bound lets the idle-timeout assertions accept a 30-second default instead of the configured two seconds; the mock-clock tests do not cover that integration, although the current production path is correct. Location: [`test/functional/interface_http.py:101`](<https://git.fish.foo/bitcoin/bitcoin/src/commit/75a23e7d36afbbcfedef11bca94967b88bf40de0/test/functional/interface_http.py#L101>) (head). Review coverage was incomplete. <!-- Review tier: routine --> --- Reviewed: [`75a23e7d36af`](<https://git.fish.foo/bitcoin/bitcoin/commit/75a23e7d36afbbcfedef11bca94967b88bf40de0>) · [Review report](<https://review.fish.foo/report/36848-75a23e7d36afbbcfedef11bca94967b88bf40de0-2608-2.html>) · [Previous reports](<https://review.fish.foo/traces/36848/>) [permalink](<https://review.fish.foo/report/36848-75a23e7d36afbbcfedef11bca94967b88bf40de0-2608-2.html>)
maflcko commented 2026-11-13 13:04:14 +00:00 (Migrated from github.com)

This follows the general pattern, see also github.com/bitcoin/bitcoin@aa76bd266d

lgtm ACK 75a23e7d36

Haven't tried your mutant.

This follows the general pattern, see also https://github.com/bitcoin/bitcoin/commit/aa76bd266df9742a266d52e0e5da8dbf033658f6 lgtm ACK 75a23e7d36afbbcfedef11bca94967b88bf40de0 Haven't tried your mutant.
fanquake commented 2026-11-13 15:10:11 +00:00 (Migrated from github.com)

cc @hodlinator

cc @hodlinator
Pranav-error commented 2026-11-16 06:41:32 +00:00 (Migrated from github.com)

The PR makes the disconnect-timeout test less flaky by removing the upper time-bound check. It still verifies that the server doesn't disconnect too early, and the socket read timeout catches cases where it never disconnects.

tACK 75a23e7d36. Ran interface_http.py with the PR and it passes. With the mutant from the description, it fails with a TimeoutError after about 71 seconds in recv_raw.

The PR makes the disconnect-timeout test less flaky by removing the upper time-bound check. It still verifies that the server doesn't disconnect too early, and the socket read timeout catches cases where it never disconnects. tACK 75a23e7d36afbbcfedef11bca94967b88bf40de0. Ran `interface_http.py` with the PR and it passes. With the mutant from the description, it fails with a `TimeoutError` after about 71 seconds in `recv_raw`.
fanquake commented 2026-11-16 11:44:04 +00:00 (Migrated from github.com)

Backported to 32.x in #36727.

Backported to `32.x` in #36727.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitcoin/bitcoin!36848
No description provided.