Repository navigation
fix(http): route HTTP-mode sockets through close_socket on force close - #65
detail-app[bot] wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
============================================
+ Coverage 86.82% 86.83% +0.01%
+ Complexity 616 615 -1
============================================
Files 60 60
Lines 16979 16985 +6
Branches 490 490
============================================
+ Hits 14742 14749 +7
Misses 1913 1913
+ Partials 324 323 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
|
Detail bug report: View on Detail
Change
elide_transport_socket_closenever checked whether a socket was in HTTP mode and never routed throughhttp::close_socket. It removed the raw connection, workload, and serving entries while leaving thestate.http.socketsentry behind. When no cancellable operation remained at close time — the normal state on non-io_uring backends and on io_uring with non-default capacity — nothing ever completed for that socket again, so the HTTP state became a permanent zombie: noEVENT_CLOSEDwas delivered, queued response parts were silently dropped, and thehttp.socketsentry (exchanges, retry list, pinned-body accounting) leaked until driver retirement.The fix adds an
http::is_httpcheck at the top ofelide_transport_socket_close. If the socket is in HTTP mode, it callshttp::close_socket(the same teardown path the workload-sweep already uses) and extends the resulting events intostate.http.overflowfor delivery on the next poll. This matches the semantics consumers already observe when an operation happens to be in flight at close time — it only extends the teardown to the window where the accidental persistent-receive net is absent.Affected layers: Rust ABI (
crates/bemo/src/abi/socket.rs), integration tests (crates/bemo/tests/http.rs). No ABI symbol, layout, or version changes.Closes #58
Validation
cargo build --workspace --locked— passescargo fmt --package bemo --check— passescargo clippy --package bemo --all-targets --locked -- -D warnings— passescargo test --workspace --doc --locked— passescargo test --manifest-path fuzz/Cargo.toml --lib --locked— passes (7/7 fuzz seed replays)cargo nextest run -p bemo --lib --tests --locked(default/auto backend) — 387/389 pass; 2 pre-existing failures (persistent_keepalive_reuses_receive_registration_and_fixed_send_state,arm_receive_failure_leaves_socket_dormant) confirmed present on the unmodified baseline viagit stashELIDE_TRANSPORT_TEST_BACKEND=epoll cargo nextest run -p bemo --lib --tests --locked --profile epoll— 389/389 pass (the backend where the bug manifested)ELIDE_TRANSPORT_TEST_BACKEND=io-uring cargo nextest run -p bemo --lib --tests --locked— 387/389 pass (same 2 pre-existing failures)Six new integration tests added to
crates/bemo/tests/http.rs, all passing on default, epoll, and io_uring backends:parked_http_socket_close_emits_closed_and_cleans_up— the core bug: a parked HTTP socket (body larger thanBODY_WINDOW_BYTES, segments never acked) force-closed viasocket_closedeliversEVENT_CLOSEDand drains the owner budgetparked_http_socket_close_fails_queued_streaming_parts— queued streaming response parts are failed withEVENT_PART_SENTerror events rather than silently droppednon_http_socket_close_is_unaffected— non-HTTP sockets still follow the raw close pathdouble_close_of_http_socket_returns_invalid— second close returnsINVALIDclose_http_socket_with_inflight_receive_emits_one_closed— exactly oneEVENT_CLOSED(no duplicates from the cancellation completion path)ack_after_parked_close_produces_no_events— acking held segments after close cannot resurrect the socket or produce new HTTP eventsPlatform tested: Linux (epoll and io_uring). No ABI version or layout changes; no FFM or Native Image impact.
Automatic Fixes PRs can be configured here.