Skip to content

fix(envoy-client): bound the shared WebSocket writer queue #5468

Description

@NathanFlurry

Problem

The native and WASM envoy-client transports feed the single actor-to-engine WebSocket writer through an unbounded mpsc channel. If producers outpace the socket, queued protocol messages can grow without bound.

This is a shared transport issue, not specific to SSE. The queue carries HTTP request/response chunks alongside WebSocket traffic, events, SQLite, and other envoy messages, so an SSE-only limit would leave the generic failure mode in place.

Desired behavior

  • Bound queued writer memory across all message types.
  • Apply backpressure or fail fast without blocking an actor's serialized event loop.
  • Preserve control-message progress and disconnect/reconnect semantics.
  • Define fair accounting for differently sized messages; a message-count-only bound is insufficient.
  • Add saturation tests for native and WASM transports, including HTTP streaming, WebSockets, events, and SQLite.
  • Add queue-depth/queued-byte and overload metrics.

Relevant code

  • engine/sdks/rust/envoy-client/src/connection/native.rs
  • engine/sdks/rust/envoy-client/src/connection/wasm.rs
  • engine/sdks/rust/envoy-client/src/connection/mod.rs

Discovered while reviewing the HTTP/SSE streaming change.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions