-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Do not send replay frames to spectator server if initial begin play invocation failed #37159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+69
−19
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question I pose is that what if it takes a long time but doesn't fail? We are potentially dropping frames from the start of a recorded replay... unless I'm missing something.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've not looked into it. If it's a real shortcoming, it's already in master.
My hope based on what I know about signalr delivery guarantees would be that signalr side invocation ordering would delay / queue the client frame sending calls until the begin play call succeeds, but I've not tested. I can try testing it tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference on master may be the clearing of frames which was added here. But yeah, let's investigate this one before pushing this out.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been putting it off because I knew it was going to be annoying but I did finally test this today.
What I basically did is I took a full-stack
osu+osu-server-spectator+osu-websetup and:osu-server-spectator, insideBeginPlaySessionThe good case (
BeginPlaySessionsucceeds server-side after 15s)The sequence of events is basically such:
SpectatorClient.BeginPlaying(). That method viaosu/osu.Game/Online/Spectator/SpectatorClient.cs
Line 227 in d3c820b
osu/osu.Game/Online/Spectator/SpectatorClient.cs
Line 310 in d3c820b
osu/osu.Game/Online/Spectator/SpectatorClient.cs
Line 229 in d3c820b
HandleFrame()/purgePendingFrames()/SendFramesInternal()/SendFrameData()(outbound to signalr). Of note, all of this is able to fire, becauseisPlayinghas been true all this time even though the server still hasn't responded to theBeginPlaySession()request - but the signalr invocations appear to all be buffered client-side, because the server isn't receiving these invocations yet, either.BeginPlaySession()succeeds, the client-side signalr buffer is flushed, and the server receives all of the backloggedSendFrameData()invocations and continues from there.SendFrameData().client-side logs
server-side logs
The bad case (
BeginPlaySession()fails server-side after 15s)SpectatorClient.BeginPlaying(), setsisPlaying = true, and continues to callHandleFrame()/purgePendingFrames()/SendFramesInternal()/SendFrameData()(outbound to signalr) until the server is done.BeginPlaySession()fails, and the client-side signalr buffer is flushed. At this point two things happen on both ends:a. The server receives all of the backlogged
SendFrameData()invocations. BecauseBeginPlaySession()failed and the user's spectator state is basically such that they're not in a play session, all of the backlogged invocations are dropped.b. The client receives the exception that failed the invocation of
BeginPlaySession(). In response, the user is denoted as no-longer-playing viaosu/osu.Game/Online/Spectator/SpectatorClient.cs
Line 238 in d3c820b
osu/osu.Game/Online/Spectator/SpectatorClient.cs
Line 320 in d3c820b
isPlayingis set tofalse, all incomingHandleFrame()invocations, which come directly from gameplay and are supposed to enqueue incoming frames as pending for submission later are dropped viaosu/osu.Game/Online/Spectator/SpectatorClient.cs
Lines 253 to 257 in d3c820b
osu/osu.Game/Online/Spectator/SpectatorClient.cs
Lines 392 to 400 in d3c820b
client-side logs
server-side logs
Hope this wall of text assuages doubts and hasn't just been a complete waste of time.