Skip to content

test: clean up interface_http and improve idle timeout coverage#34772

Open
pinheadmz wants to merge 2 commits intobitcoin:masterfrom
pinheadmz:rpctimeout-busy-idle
Open

test: clean up interface_http and improve idle timeout coverage#34772
pinheadmz wants to merge 2 commits intobitcoin:masterfrom
pinheadmz:rpctimeout-busy-idle

Conversation

@pinheadmz
Copy link
Member

This is a follow-up to #32408 and a new prerequisite for #32061 in response to a review comment about the replacement HTTP server behavior.

In #32061 (comment) it is pointed out that the idle timeout set by -rpcservertimeout could disconnect a client unfairly if it was the server that was taking too long to process a response. That misbehavior was confirmed and #32061 was updated to match current libevent behavior.

This PR asserts the current libevent behavior by adding another test using RPC waitforblock past the -rpcservertimeout value and then verifying that the HTTP connection is still open. The test currently passes on #32061 and I'll rebase when ready.

Also since I am extending this test module again I refactored the monolithic test to resemble the current functional test style in the repository, deduplicating HTTP connection code with a helper class and separating individual test cases into functions.

I'm trying to figure out how to get a clean transcript of both old and new tests from Wireshark, and I'll post that for extra confidence.

@DrahtBot DrahtBot added the Tests label Mar 7, 2026
@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 7, 2026

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

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK Bortlesboat

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

@pinheadmz pinheadmz force-pushed the rpctimeout-busy-idle branch from b1af6f5 to b2bfeab Compare March 7, 2026 23:22
Copy link

@Bortlesboat Bortlesboat left a comment

Choose a reason for hiding this comment

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

Tested ACK b2bfeab. Checked out the branch, ran interface_http.py locally — all passes. The BitcoinHTTPConnection helper cleans up the test nicely and the new check_server_busy_idle_timeout case is a good addition for the rpcservertimeout behavior. Found one minor typo (inline).

good_http_request = "GET /test2 HTTP/1.1\r\nHost: somehost\r\n\r\n"
conn.reset_conn()
conn.conn.sock.sendall(good_http_request.encode("utf-8"))
respose2 = conn.recv_raw()

Choose a reason for hiding this comment

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

Nit: typo respose2 -> response2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants