Skip to content

fix(server): bound origin http.Server writes to clear the zero-window wedge (RIG-1319) - #33

Open
rigel-mintaka wants to merge 1 commit into
mainfrom
pipelines/rig-1319-origin-write-timeout
Open

fix(server): bound origin http.Server writes to clear the zero-window wedge (RIG-1319)#33
rigel-mintaka wants to merge 1 commit into
mainfrom
pipelines/rig-1319-origin-write-timeout

Conversation

@rigel-mintaka

Copy link
Copy Markdown

Add a rolling per-response write-deadline guard to the woodpecker origin
http.Server(s) so a slow or stuck client that stops reading (a zero-window
wedge) can no longer orphan a connection forever.

cmd/server: setupServerTimeouts applies ReadHeaderTimeout, WriteTimeout, and
IdleTimeout to all four http.Server constructions; ReadTimeout is deliberately
left zero (small bodies; agent log upload rides gRPC on :9000).

server/api: writedeadline.go adds newResponseController (unwraps past gin so
FlushError surfaces), extendWriteDeadline, and slowHandlerProgress — the seam
that re-arms a rolling per-response deadline for handlers that legitimately
outrun the server-wide WriteTimeout. SSE streams (stream.go) re-arm before each
write and gain an absolute streamMaxDuration ceiling for ping-only streams; the
queue long-poll, RepairAllRepos, and the login/user forge-paging handlers re-arm
per unit of progress and abort with 499 when the client goes away.

Co-authored-by: Matt Wilkinson matt@rigel.build
Spec-impact: none (orion spec updated separately). Refs RIG-1319

@linear-code

linear-code Bot commented Aug 30, 2026

Copy link
Copy Markdown

RIG-1319

… wedge (RIG-1319)

Add a rolling per-response write-deadline guard to the woodpecker origin
http.Server(s) so a slow or stuck client that stops reading (a zero-window
wedge) can no longer orphan a connection forever.

cmd/server: setupServerTimeouts applies ReadHeaderTimeout, WriteTimeout, and
IdleTimeout to all four http.Server constructions; ReadTimeout is deliberately
left zero (small bodies; agent log upload rides gRPC on :9000).

server/api: writedeadline.go adds newResponseController (unwraps past gin so
FlushError surfaces), extendWriteDeadline, and slowHandlerProgress — the seam
that re-arms a rolling per-response deadline for handlers that legitimately
outrun the server-wide WriteTimeout. SSE streams (stream.go) re-arm before each
write and gain an absolute streamMaxDuration ceiling for ping-only streams; the
queue long-poll, RepairAllRepos, and the login/user forge-paging handlers re-arm
per unit of progress and abort with 499 when the client goes away.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Spec-impact: none (orion spec updated separately). Refs RIG-1319
@rigel-mintaka
rigel-mintaka force-pushed the pipelines/rig-1319-origin-write-timeout branch from b5a0247 to 7d75299 Compare August 30, 2026 17:15
@rigel-mintaka
rigel-mintaka marked this pull request as ready for review August 30, 2026 17:52
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