broadcaster: rebuild the Xbox Live client after a failed session re-create - #36
broadcaster: rebuild the Xbox Live client after a failed session re-create#36HashimTheArab wants to merge 3 commits into
Conversation
…reate recreateSession rebuilt signaling, session, and listener but reused the cached xsapi client, so a dead RTA connection inside it failed every re-announce identically and the broadcaster looped on the same error every two minutes until the pod was restarted. Once a rebuild has already failed, the next one first closes and forgets the primary client the broadcaster created, so the fresh rebuild dials Xbox Live again. Caller-owned clients are left alone. The go-xsapi pin moves to the branch that stops rta.Conn from closing itself after a short outage.
|
Warning Review limit reachedNext included review available in 32 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesSession recreation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🟡 Moderate · up to The PR rebuilds broadcaster-owned Xbox Live clients after repeated session-recreation failures, improving recovery, but failed cleanup can leave an authenticated connection orphaned while later retries create replacements. Merge should wait for retryable cleanup ownership or explicit acceptance of this bounded security and availability risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
Why
During the 2026-09-02 Xbox Live outage the eu-central and eu-west broadcasters lost their RTA WebSocket.
rta.Conngave up after its short redial budget and closed itself, and from then on everyre-announce sessionfailed with the samerta: reconnect: max reconnect attempt (4) reached.recreateSessionrebuilt signaling, the session, and the listener, but reused the cachedxsapi.Clientand with it the dead RTA connection, so the broadcaster looped on that error every two minutes until the pod was restarted by hand. Friend requests kept being accepted while the invites failed withno active MPSD session.What changed
recreateSessiontracks consecutive failures. Once a rebuild has already failed, the next one first closes and forgets the primary Xbox Live client the broadcaster created, so the rebuild dials a fresh client (and a fresh RTA connection) through the existing lazy paths. Derived Minecraft token sources are cleared the same waycloseCreatedXBLClientReferencesalready does at shutdown. A caller-supplied client is never touched.rta.Connkeeps reconnecting with capped backoff instead of closing itself. That is the primary fix; this change is the safety net for any other way a connection can end up closed.Sub-account clients keep their own RTA connections and are not rebuilt here; they will benefit from #28 directly.
Tests
go test ./...passes. The new test drives two consecutive failed rebuilds through a failing signaling factory and checks that the created client is closed and forgotten only after the second failure, and that a caller-owned client is kept.🤖 Generated with Claude Code
https://claude.ai/code/session_01GMfvFUjXaF2P5m2gUmAJaT
Summary by CodeRabbit
Bug Fixes
Tests