Skip to content

Cancel server work when clients disconnect - #707

Open
mcollina wants to merge 1 commit into
antirez:mainfrom
mcollina:server-client-disconnect-cancellation
Open

Cancel server work when clients disconnect#707
mcollina wants to merge 1 commit into
antirez:mainfrom
mcollina:server-client-disconnect-cancellation

Conversation

@mcollina

@mcollina mcollina commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • detect client FIN/RST while requests are queued or being processed
  • detach abandoned queued/assigned jobs and cooperatively cancel prefill and decode work
  • preserve in-flight decode and stack-owned job/socket lifetime during cancellation and shutdown
  • prevent cancelled requests from publishing responses or stale live continuation state
  • add no-model regressions for socket detection, queue ownership, progress cancellation, and decode accounting

A graceful peer FIN, including a write-side half-close, is intentionally treated as request cancellation for this one-request HTTP/1.1 server.

Validation

  • make -j2 ds4_test ds4-server ds4_server_cpu.o
  • ./ds4_test --server
  • server-only test group repeated successfully
  • git diff --check

A live model disconnect smoke test was not run; the existing server process was left running.

@mcollina

mcollina commented Aug 5, 2026

Copy link
Copy Markdown
Author

Most harness have short timeouts and quick retries. This change avoid that a busy queue become a self-dos.

@mcollina
mcollina force-pushed the server-client-disconnect-cancellation branch from eea7924 to e9ded97 Compare August 5, 2026 20:51
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