fix(router): stream request bodies through to backend UDS #57

Merged
zaelgohary merged 1 commit from development_stream_proxy_body into development 2026-04-26 07:21:43 +00:00
Member

Summary

Replaces axum::body::to_bytes(body, 16 MiB).unwrap_or_default() + Full<Bytes> buffering in service_proxy_root / service_proxy_path with a streaming axum::body::Body passed straight into the hyper + hyperlocal client. Router memory no longer grows with body size, and there is no longer a router-level upload ceiling.

#55

Changes

  • crates/hero_router/src/server/routes.rsproxy_to_socket + service_proxy_inner take axum::body::Body instead of &axum::body::Bytes; Client<UnixConnector, axum::body::Body> built via Client::builder(TokioExecutor); two to_bytes buffering calls removed.

Test Results

cargo check -p hero_router ✓, cargo clippy -p hero_router -- -D warnings ✓, cargo fmt --check -p hero_router ✓, cargo test -p hero_router ✓.

Manual verification

Deployed locally on herodev and re-ran PUT uploads against hero_foundry through the router: 20 MB (0.07 s), 100 MB (0.52 s), 500 MB (2.45 s), 1 GB (4.77 s) — all 200. Router VmRSS baseline 27 MB, peaked at 28.9 MB during the 1 GB upload (constant-memory proxying vs. the prior 16 MB buffered ceiling). All 7 office e2e tests in hero_os still pass.

Note for reviewers

This PR removes the only router-level body size ceiling. Backend services are now the sole authority for their own upload limits.

## Summary Replaces `axum::body::to_bytes(body, 16 MiB).unwrap_or_default()` + `Full<Bytes>` buffering in `service_proxy_root` / `service_proxy_path` with a streaming `axum::body::Body` passed straight into the `hyper` + `hyperlocal` client. Router memory no longer grows with body size, and there is no longer a router-level upload ceiling. ## Related Issue #55 ## Changes - `crates/hero_router/src/server/routes.rs` — `proxy_to_socket` + `service_proxy_inner` take `axum::body::Body` instead of `&axum::body::Bytes`; `Client<UnixConnector, axum::body::Body>` built via `Client::builder(TokioExecutor)`; two `to_bytes` buffering calls removed. ## Test Results `cargo check -p hero_router` ✓, `cargo clippy -p hero_router -- -D warnings` ✓, `cargo fmt --check -p hero_router` ✓, `cargo test -p hero_router` ✓. ## Manual verification Deployed locally on herodev and re-ran PUT uploads against hero_foundry through the router: 20 MB (0.07 s), 100 MB (0.52 s), 500 MB (2.45 s), 1 GB (4.77 s) — all 200. Router VmRSS baseline 27 MB, peaked at 28.9 MB during the 1 GB upload (constant-memory proxying vs. the prior 16 MB buffered ceiling). All 7 office e2e tests in hero_os still pass. ## Note for reviewers This PR removes the only router-level body size ceiling. Backend services are now the sole authority for their own upload limits.
fix(router): stream request bodies through to backend UDS instead of buffering
All checks were successful
Build & Test / check (push) Successful in 1m49s
Build & Test / check (pull_request) Successful in 1m45s
8a29ef2f96
Closes #55. Replaces axum::body::to_bytes(body, LIMIT) + Full<Bytes>
buffering in service_proxy_* with an axum::body::Body passed directly to
the hyper+hyperlocal client.

Effects:
- no upload size ceiling (was 16 MB, locally patched to 256 MB)
- router memory no longer grows with body size (~27 MB RSS at baseline,
  stays flat during a 1 GB upload)
- oversize uploads surface the backend's response instead of the router
  silently truncating to an empty body and the client seeing
  ERR_EMPTY_RESPONSE
zaelgohary merged commit 68faf0f678 into development 2026-04-26 07:21:43 +00:00
zaelgohary deleted branch development_stream_proxy_body 2026-04-26 07:21:43 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
lhumina_code/hero_router!57
No description provided.