rusackas opened a new pull request, #40856:
URL: https://github.com/apache/superset/pull/40856
### SUMMARY
The websocket sidecar's `trackClient` accepted every incoming connection
unconditionally, with no cap on how many sockets a single channel — or the
server overall — could hold.
This adds two **opt-in** connection limits:
| Config | Env var | Default |
|--------|---------|---------|
| `maxConnectionsPerChannel` | `MAX_CONNECTIONS_PER_CHANNEL` | `0`
(disabled) |
| `maxTotalConnections` | `MAX_TOTAL_CONNECTIONS` | `0` (disabled) |
Both default to `0`, which disables the check — so **existing deployments
behave exactly as before** until an operator sets a positive value based on
their capacity planning. When a configured limit is reached, `wsConnection`
refuses the new socket with WebSocket close code `1013` ("Try Again Later")
**before** it is tracked, and emits a `ws_connection_rejected` statsd counter
for observability.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — sidecar behavior, config-gated.
### TESTING INSTRUCTIONS
```
cd superset-websocket
npm ci
npm test
```
New tests cover: limits disabled by default, per-channel limit reached,
total limit reached, and `wsConnection` closing an over-limit socket (code
1013) without tracking it.
### 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]