Skip to content

fix(server): close the connection when the node body limit is exceeded - #2206

Merged
dinwwwh merged 1 commit into
1.xfrom
claude/github-issue-2205-1053ed
Oct 12, 2026
Merged

dinwwwh merged 1 commit into
1.xfrom
claude/github-issue-2205-1053ed

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Oct 12, 2026

Copy link
Copy Markdown
Member

When the Node `BodyLimitPlugin` rejects a request with 413, the response now carries `Connection: close`. Keep-alive clients open a fresh socket for their next request instead of failing with `ECONNRESET` after about 6 seconds. Closes #2205.

Fixes

  • The 413 response tells HTTP/1 keep-alive clients not to reuse the socket. The plugin stops reading the body once the limit is hit, so that socket could never serve another request. The rest of the body is still not drained, so the limit keeps its purpose.
  • Applies to both rejection paths: an oversized `content-length` and a body that grows past the limit while streaming.
  • HTTP/2 responses are unchanged, with no header and no Node `UnsupportedWarning`. The header is also skipped when response headers have already been sent.

Testing

  • New regression test replays the issue's setup (keep-alive agent, one socket): an oversized request, then a normal one. It covers both the `content-length` and the streamed body paths and checks for a 413 with `Connection: close`, then a 200. Both cases fail on the previous code.
  • New HTTP/2 test checks that the 413 still arrives and the header is not set.
  • `packages/server` and `packages/standard-server-node` suites pass (453 tests).

BodyLimitPlugin stops reading the request body once the limit is hit, so the
connection cannot serve another request. The 413 response now carries
`Connection: close` (HTTP/1 only) so keep-alive clients open a new socket
instead of failing with ECONNRESET on their next request.

Closes #2205
@pullfrog

pullfrog Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

This run hit its time limit while still working, so it stopped before finishing.

Give runs longer with --timeout=2h (or --notimeout) in this repo's instructions — or raise the workflow's timeout input if it sets one, since that input wins. A smaller PR or a lower effort also finishes sooner.

Repo settings → · Flags →

agent run timed out after 1h

Pullfrog  | Rerun failed job ➔ | View workflow run | via Pullfrog | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@2206

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@2206

@orpc/client

npm i https://pkg.pr.new/@orpc/client@2206

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@2206

@orpc/experimental-durable-iterator

npm i https://pkg.pr.new/@orpc/experimental-durable-iterator@2206

@orpc/hey-api

npm i https://pkg.pr.new/@orpc/hey-api@2206

@orpc/interop

npm i https://pkg.pr.new/@orpc/interop@2206

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@2206

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@2206

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@2206

@orpc/openapi-client

npm i https://pkg.pr.new/@orpc/openapi-client@2206

@orpc/otel

npm i https://pkg.pr.new/@orpc/otel@2206

@orpc/experimental-pino

npm i https://pkg.pr.new/@orpc/experimental-pino@2206

@orpc/experimental-publisher

npm i https://pkg.pr.new/@orpc/experimental-publisher@2206

@orpc/experimental-publisher-durable-object

npm i https://pkg.pr.new/@orpc/experimental-publisher-durable-object@2206

@orpc/experimental-ratelimit

npm i https://pkg.pr.new/@orpc/experimental-ratelimit@2206

@orpc/react

npm i https://pkg.pr.new/@orpc/react@2206

@orpc/react-query

npm i https://pkg.pr.new/@orpc/react-query@2206

@orpc/experimental-react-swr

npm i https://pkg.pr.new/@orpc/experimental-react-swr@2206

@orpc/server

npm i https://pkg.pr.new/@orpc/server@2206

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@2206

@orpc/solid-query

npm i https://pkg.pr.new/@orpc/solid-query@2206

@orpc/standard-server

npm i https://pkg.pr.new/@orpc/standard-server@2206

@orpc/standard-server-aws-lambda

npm i https://pkg.pr.new/@orpc/standard-server-aws-lambda@2206

@orpc/standard-server-fastify

npm i https://pkg.pr.new/@orpc/standard-server-fastify@2206

@orpc/standard-server-fetch

npm i https://pkg.pr.new/@orpc/standard-server-fetch@2206

@orpc/standard-server-node

npm i https://pkg.pr.new/@orpc/standard-server-node@2206

@orpc/standard-server-peer

npm i https://pkg.pr.new/@orpc/standard-server-peer@2206

@orpc/svelte-query

npm i https://pkg.pr.new/@orpc/svelte-query@2206

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@2206

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@2206

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@2206

@orpc/vue-colada

npm i https://pkg.pr.new/@orpc/vue-colada@2206

@orpc/vue-query

npm i https://pkg.pr.new/@orpc/vue-query@2206

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@2206

commit: bb118df

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
orpc 90f2d8b Oct 12 2026, 02:32 AM

@dinwwwh
dinwwwh merged commit 9cc513a into 1.x Oct 12, 2026
4 of 6 checks passed
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.

1 participant