Details
3. Run
python poc.py
4. Expected results
A fixed implementation should send data and complete for both one and two, then permit three to start and complete.
The behavior is:
{
'first': [
{'type': 'data', 'id': 'one', 'payload': {'data': {'oneShot': 'marker'}}},
{'type': 'complete', 'id': 'one'}
],
'second': [
{'type': 'data', 'id': 'two', 'payload': {'data': {'oneShot': 'marker'}}},
{'type': 'complete', 'id': 'two'}
],
'third': {
'type': 'error',
'id': 'three',
'payload': {'message': 'Subscription limit reached'}
}
}
The exact formatting and fields may vary slightly by Strawberry version, but the decisive observation is that one and two both receive complete, while three receives Subscription limit reached with a different operation ID.
Impact
When the legacy graphql-ws protocol and max_subscriptions_per_connection are enabled, a client can fill the configured operation slots on its persistent connection with one-shot subscriptions that have already completed. Subsequent legitimate operations on that connection may be rejected even though no corresponding subscriptions remain active.
The primary demonstrated impact is connection-level availability and incorrect resource accounting. Multiple long-lived connections could increase the amount of retained task/subscription state, but this bounded test does not establish memory exhaustion or cross-connection denial of service.
Exposure depends on:
- the application explicitly enabling the legacy
graphql-wsprotocol; - the application configuring
max_subscriptions_per_connection; - clients being able to maintain a persistent WebSocket connection;
- the resolver exposing a finite operation that naturally completes;
- the absence of effective connection lifetime, connection-count, authorization, or rate limits.
This report does not claim impact on the modern graphql-transport-ws protocol, on applications without the per-connection cap, or on every deployment. It is distinct from the already fixed unlimited-subscription behavior.
Maintainer note
Confirmed and reproduced against 0.327.0. The max_subscriptions_per_connection feature this affects was introduced in 0.312.3 (#4344), so the affected range is >= 0.312.3, <= 0.327.0.
Fixed by https://github.com/strawberry-graphql/strawberry/pull/4610: operations now release their slot when they complete on their own or fail before execution, and a late stop for a completed operation is a no-op. The fix was released in 0.327.2.