rusackas opened a new pull request, #40857: URL: https://github.com/apache/superset/pull/40857
### SUMMARY When broadcasting events, `sendToChannel` called `ws.send()` unconditionally. A slow or stalled client that stops reading its socket would cause the server's per-connection outbound buffer to grow without bound, consuming server memory and degrading service for everyone on the sidecar. This adds an **opt-in** per-socket send-buffer cap: | Config | Env var | Default | |--------|---------|---------| | `maxSocketBufferBytes` | `MAX_SOCKET_BUFFER_BYTES` | `0` (disabled) | It defaults to `0`, which disables the check — **existing deployments are unaffected**. When a positive value is configured, a socket whose `bufferedAmount` exceeds the cap is terminated and cleaned up before the next send, and a `ws_client_backpressure_disconnect` statsd counter is emitted. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A — sidecar behavior, config-gated. ### TESTING INSTRUCTIONS ``` cd superset-websocket npm ci npm test ``` New tests cover: cap disabled by default (no termination), a client over the cap terminated + counted + channel cleaned, and a client within the cap still receiving sends. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [x] Introduces new feature or API - [ ] Removes existing feature or API 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
