Skip to content

Bound SSE buffering and stop polling when a client cannot receive events #345

Closed

Description

@samuelmbabhazi

Problem

The event stream continues polling and writing when the HTTP writable buffer is saturated. An authenticated account with environment.read, a sufficiently large accessible history and a slow connection can make the API retain queued event data.

The existing controls remain useful: eight streams per account, batches of 100 every two seconds, a one-hour lifetime and repeated credential/permission checks. They do not implement a byte budget or wait for the writable stream to drain. This is a conditional availability risk, not a demonstrated process crash.

Evidence

Audited code: c761e67d1aad834679cfae5569f8722e74084f4d; the subsequently merged ADR-only #341 does not change this path.

An isolated local test invoked the actual pumpEvents with a blocked Node Writable: 1,000 writes continued after 1,000 false returns, retaining 256,000 bytes in ten simulated polling cycles. This test did not involve a live HTTP/Caddy connection or demonstrate an OOM.

Acceptance criteria

  • Wait for drain, or close slow streams within an explicit bounded time/queued-byte budget.
  • Stop fetching further database batches while the client cannot accept the current batch.
  • Disconnect, abort and shutdown release listeners and buffered work promptly.
  • Preserve live credential/permission checks while waiting, or use a bounded deadline that preserves the revocation guarantee.
  • Cover a blocked writer and a slow client through Caddy with bounded resource assertions; normal delivery/reconnection still work.

Activity

  1. added
    bug
    priority:P2
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P2securitytrack:control-plane

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions