Skip to content

fix(tests): consume the request body in the proxy stub before replying - #91

Open
maxlamagna wants to merge 1 commit into
bcurts:mainfrom
maxlamagna:fix/proxy-stub-reads-request-body
Open

fix(tests): consume the request body in the proxy stub before replying#91
maxlamagna wants to merge 1 commit into
bcurts:mainfrom
maxlamagna:fix/proxy-stub-reads-request-body

Conversation

@maxlamagna

Copy link
Copy Markdown
Contributor

Closes #89.

ProxyHeaderForwardingTests' stub server replies to a POST without reading the request body. Closing a socket that still holds unread data can make the OS send RST rather than a clean FIN, and an RST can cause the peer's kernel to discard what it has already buffered for that socket — including the response the client received but had not yet read. mcp_proxy then correctly surfaces the dead connection as a 502, so the test fails while the product code is behaving properly.

It is load-sensitive, which is why the same commit can pass one run and fail the next.

Test-only: no product code, no live server, no credentials, no user data.

The sibling stub in the same class implements only do_GET, which carries no request body, so it cannot hit this and is left alone.

Locally, running that file 15 times went from 6 failures to 0. Load was not held constant between the two runs, so that number is indicative; the mechanism in #89 is the substantive claim.


This is the first of several small changes we would like to offer, and it is deliberately first: until it lands, a full-suite run on any of the others has a chance of failing for reasons unrelated to the change under review. The rest are #67 (concurrent per-project wrapper sessions) and the three-PR stack described in #90.

ProxyHeaderForwardingTests' stub replies to a POST without reading the request body. Closing a socket that still holds unread data makes the OS send RST rather than a clean FIN, and RST tells the peer's kernel to discard what it has already buffered for that socket - including the response the client received but had not yet read. mcp_proxy then correctly surfaces the dead connection as a 502, so the test fails while the product code is behaving properly.

It is load-sensitive, which is why the same commit can pass one run and fail the next.

The sibling stub in this class only implements do_GET, which carries no request body and so cannot hit this.
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.

ProxyHeaderForwardingTests intermittently fails with a 502 from a connection reset

1 participant