Skip to content

fix(sdk): release completed embedded request signals - #53082

Closed
opencode-agent[bot] wants to merge 1 commit into
v2from
effect-web-retention
Closed

opencode-agent[bot] wants to merge 1 commit into
v2from
effect-web-retention

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Problem

In the embedded SDK, a live host keeps completed Web Request objects after response consumption and GC. With 200 sequential server.info() calls, 201 Request objects remain after a 100 ms idle turn; a plain handler does not show the same growth. The combination of the Effect Web handler and AbortSignal.any([source.signal, shutdown.signal]) retains requests until the host shuts down. This is distinct from the projection worker backlog in anomalyco/anomaly#623.

Fix

Bridge caller cancellation and host shutdown through a per-request controller, then detach both upstream abort listeners when the response completes or is cancelled. This keeps active-request cancellation and shutdown behavior without keeping completed requests attached to the long-lived host signal.

Verification

  • New real embedded Effect SDK regression: 201 additional live Request objects on the base branch, fewer than 20 after this change; repeat runs pass.
  • New active caller-abort and host-shutdown test passes.
  • SDK bun typecheck, scoped oxlint, Prettier, and git diff --check pass.
  • Existing transport.test.ts and promise.test.ts have three unrelated assertion failures in this checkout, reproduced on the unchanged base; this change does not add failures in those files.

This is a source fix for review, not a production deployment. The production profile's full RSS/array-buffer footprint has not been attributed solely to these request objects. Related: anomalyco/anomaly#260 and draft #51012 (its earlier approach did not fix the embedded path).

Requested by: @kitlangton (Kit via Slack)

@kitlangton

Copy link
Copy Markdown
Contributor

Superseded by #53613.

@kitlangton kitlangton closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant