Repository navigation
chore(gql-middleware): log active subscriptions when the concurrent limit is reached - #25909
Conversation
…imit is reached When a connection reaches max_connection_concurrent_subscriptions, the middleware rejects each new subscription with "Limit exceeded: Maximum N concurrent subscriptions allowed." The log line says nothing about what is holding the slots, so a client that accumulates subscriptions cannot be diagnosed after the fact. On the first rejection per connection, log one warning with the rejected operation, the active count and the active subscriptions grouped by operation name, highest count first. Later rejections on the same connection keep the existing error line only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe change adds Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The change adds once-per-connection subscription-limit diagnostics without changing limit enforcement. No merge-blocking issue is identified; merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change preserves subscription limits and connection isolation. Its main residual risk is oversized diagnostic output: logging only once per connection limits frequency, but does not bound the combined size of operation names. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🧪 Generate unit tests (beta)
🛠️ Fix failing CI checks 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
⏳ Automated tests are running... |
ee83789
into
bigbluebutton:v4.0.x-develop
What does this PR do?
When a browser connection reaches
max_connection_concurrent_subscriptions, bbb-graphql-middleware now logs which subscriptions are holding the slots.On the first rejection per connection it writes one warning with:
rejectedOperation: the subscription that was refusedactiveSubscriptions: how many are activeactiveSubscriptionsByOperation: the active subscriptions grouped by operation name, highest count first, for examplechatMessages=3, IsTyping=2, Users=1Later rejections on the same connection keep the existing
Limit exceedederror line only, so a client that keeps retrying does not flood the log.The grouping lives in a small
internal/subscriptionlimitpackage with no config dependency, so it has a unit test. Thecommonandwriterpackages load/usr/share/bbb-graphql-middleware/config.ymlat init and cannot be tested without it.Closes Issue(s)
None.
Motivation
On a 4.0.0-rc.3 production server, a moderator's client hit the 150-subscription limit about 88 minutes into a session. From then on the server refused every new subscription: public chat, private chats, cameras and raise-hand stopped loading until the user reloaded.
The only server-side trace was the repeated line
Limit exceeded: Maximum 150 concurrent subscriptions allowed.It says nothing about what had accumulated. The connection never reconnected, so whatever filled the 150 slots built up on one connection.We could not reproduce it. A lab session with a moderator, 45 participants, camera, screenshare, two breakout rooms and 45 private chats opened, messaged and answered peaked at 31 active subscriptions. Reading the client code did not find a subscription that stays open either. Without knowing which operations were active, the cause can't be identified, and raising the limit would only delay the failure.
This change makes the next occurrence on any server diagnosable from the log.
How to test
/etc/bigbluebutton/bbb-graphql-middleware.yml:systemctl restart bbb-graphql-middleware.Limit exceededlines continue for each rejection.cd bbb-graphql-middleware && go test ./internal/subscriptionlimit/More
go build ./...and the new test pass.go vetreports two findings inwriter.go(a non-constant format string insendErrorMessage, a discardedcontext.WithTimeoutcancel); both predate this change and are left alone.🤖 Generated with Claude Code