1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00
Commit Graph

3947 Commits

Author SHA1 Message Date
Bartłomiej Dach
04147eb689
Fix lack of correct default value spec 2024-01-03 11:46:28 +01:00
Bartłomiej Dach
e686a6a1dd
Fix player submission test intermittent failures due to audio playback discrepancy logic kicking in
See https://github.com/ppy/osu/actions/runs/7384457927/job/20087439457#step:5:133.
2024-01-03 09:17:01 +01:00
Bartłomiej Dach
3c5e9ac9a9
Fix possible double score submission when auto-retrying via perfect mod
Closes https://github.com/ppy/osu/issues/26035.

`submitOnFailOrQuit()`, as the name suggests, can be called both when
the player has failed, or when the player screen is being exited from.
Notably, when perfect mod with auto-retry is active, the two happen
almost simultaneously.

This double call exposes a data race in `submitScore()` concerning the
handling of `scoreSubmissionSource`. The race could be experimentally
confirmed by applying the following patch:

diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs
index 83adf1f960..76dd29bbdb 100644
--- a/osu.Game/Screens/Play/SubmittingPlayer.cs
+++ b/osu.Game/Screens/Play/SubmittingPlayer.cs
@@ -228,6 +228,7 @@ private Task submitScore(Score score)
                 return Task.CompletedTask;
             }

+            Logger.Log($"{nameof(scoreSubmissionSource)} is {(scoreSubmissionSource == null ? "null" : "not null")}");
             if (scoreSubmissionSource != null)
                 return scoreSubmissionSource.Task;

@@ -237,6 +238,7 @@ private Task submitScore(Score score)

             Logger.Log($"Beginning score submission (token:{token.Value})...");

+            Logger.Log($"creating new {nameof(scoreSubmissionSource)}");
             scoreSubmissionSource = new TaskCompletionSource<bool>();
             var request = CreateSubmissionRequest(score, token.Value);

which would result in the following log output:

	[runtime] 2024-01-02 09:54:13 [verbose]: scoreSubmissionSource is null
	[runtime] 2024-01-02 09:54:13 [verbose]: scoreSubmissionSource is null
	[runtime] 2024-01-02 09:54:13 [verbose]: Beginning score submission (token:36780)...
	[runtime] 2024-01-02 09:54:13 [verbose]: creating new scoreSubmissionSource
	[runtime] 2024-01-02 09:54:13 [verbose]: Beginning score submission (token:36780)...
	[runtime] 2024-01-02 09:54:13 [verbose]: creating new scoreSubmissionSource
	[network] 2024-01-02 09:54:13 [verbose]: Performing request osu.Game.Online.Solo.SubmitSoloScoreRequest
	[network] 2024-01-02 09:54:14 [verbose]: Request to https://dev.ppy.sh/api/v2/beatmaps/869310/solo/scores/36780 successfully completed!
	[network] 2024-01-02 09:54:14 [verbose]: SubmitSoloScoreRequest finished with response size of 639 bytes
	[network] 2024-01-02 09:54:14 [verbose]: Performing request osu.Game.Online.Solo.SubmitSoloScoreRequest
	[runtime] 2024-01-02 09:54:14 [verbose]: Score submission completed! (token:36780 id:20247)
	[network] 2024-01-02 09:54:14 [verbose]: Request to https://dev.ppy.sh/api/v2/beatmaps/869310/solo/scores/36780 successfully completed!
	[network] 2024-01-02 09:54:14 [verbose]: SubmitSoloScoreRequest finished with response size of 639 bytes
	[runtime] 2024-01-02 09:54:14 [error]: An unhandled error has occurred.
	[runtime] 2024-01-02 09:54:14 [error]: System.InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
	[runtime] 2024-01-02 09:54:14 [error]: at osu.Game.Screens.Play.SubmittingPlayer.<>c__DisplayClass30_0.<submitScore>b__0(MultiplayerScore s) in /home/dachb/Documents/opensource/osu/osu.Game/Screens/Play/SubmittingPlayer.cs:line 250

The intention of the submission logic was to only ever create one
`scoreSubmissionSource`, and then reuse this one if a redundant
submission request was made. However, because of the temporal proximity
of fail and quit in this particular case, combined with the fact that
the calls to `submitScore()` are taking place on TPL threads, means that
there is a read-write data race on `scoreSubmissionSource`, wherein the
source can be actually created twice.

This leads to two concurrent score submission requests, which, upon
completion, attempt to transition only _the second_
`scoreSubmissionSource` to a final state (this is because the API
success/failure request callbacks capture `this`, i.e. the entire
`SubmittingPlayer` instance, rather than the `scoreSubmissionSource`
reference specifically).

To fix, ensure correct synchronisation on the read-write critical
section, which should prevent the `scoreSubmissionSource` from being
created multiple times.
2024-01-02 10:55:52 +01:00
Bartłomiej Dach
6d124513e7
Fix test failures due to player bailing early after failing to load beatmap 2023-12-28 14:15:15 +01:00
Bartłomiej Dach
619b0cc69b
Fix code quality inspection 2023-12-28 14:12:28 +01:00
Bartłomiej Dach
24a80da83f
Merge branch 'master' into universal-offset-from-session-plays 2023-12-28 14:07:46 +01:00
Dean Herbert
e1a376c0a7
Fix using "Back" binding at spectator fail screen not working 2023-12-28 20:14:18 +09:00
Dean Herbert
b7f3c83514
Expose the ability to update global offset from the player loader screen 2023-12-28 20:01:34 +09:00
Bartłomiej Dach
1b7af989ec
Migrate BeatmapOffsetControl to use session static directly 2023-12-27 19:19:27 +01:00
Bartłomiej Dach
d4423d4933
Store last set score to a SessionStatic 2023-12-27 19:13:42 +01:00
Dean Herbert
d70fddb6fd
Fix elapsed time being counted twice on first frame 2023-12-27 00:11:22 +09:00
Dean Herbert
225528d519
Bail from score submission if audio playback rate is too far from reality
Closes https://github.com/ppy/osu/issues/23149.
2023-12-26 19:20:58 +09:00
Dean Herbert
686b2a4394
Disable positional interaction for now 2023-12-24 03:00:51 +09:00
Dean Herbert
72bec527fd
Add conditions to match stable offset adjust limitations 2023-12-24 02:36:27 +09:00
Dean Herbert
92b490f2e7
Don't bother with alt support for now 2023-12-24 01:59:48 +09:00
Dean Herbert
6f11885d4b
Add control to allow changing offset from gameplay 2023-12-23 20:51:30 +09:00
Dean Herbert
7e9522a722
Allow external use of offset text explanation 2023-12-23 20:46:12 +09:00
Dean Herbert
27a9dcc5a1
Add basic hotkey offset adjust support (via existing offset control) 2023-12-23 19:55:05 +09:00
Bartłomiej Dach
81bbdccee7
Rename ScoreInfo.{ -> Client}Version 2023-12-21 12:56:43 +01:00
Dean Herbert
a4baa0a716
Add versioning of local scores
For any potential future usage
2023-12-21 18:37:15 +09:00
rushiiMachine
ebbc8333e8
Prevent ExportReplay being spammed on fail by being held down
This was already handled in ReplayDownloadButton (98efff0bd6/osu.Game/Screens/Ranking/ReplayDownloadButton.cs (L114-L115)) but seemingly missed for SaveFailedScoreButton
2023-12-20 08:41:16 -08:00
Dan Balasescu
d7aca2f641
Add IApplicableHealthProcessor 2023-12-17 19:27:03 +09:00
Dean Herbert
27296c59de
Show back button when spectating
Avoids getting stuck at some screens.
It's a bit ugly having the back button visible like this,
but is the best approach we have for now.
2023-12-15 11:26:17 +09:00
Dean Herbert
76c4931f3a
Merge pull request #25673 from frenzibyte/fix-argon-initial-display
Fix `ArgonHealthDisplay` not displaying miss correctly during initial transition
2023-12-13 22:16:34 +09:00
Dean Herbert
3131d37621
Clear transformations with more fire 2023-12-13 17:00:21 +09:00
Dean Herbert
f2c6c348be
Fix HitError Clear methods not correctly returning pooled drawables 2023-12-13 16:13:23 +09:00
Dean Herbert
110749205d
Cache GameplayClockContainer to allow usage of OnSeek 2023-12-13 16:13:08 +09:00
Dean Herbert
eb30a603d9
Fix typo in argument name 2023-12-13 15:01:36 +09:00
Bartłomiej Dach
f69a5b44cc
Merge branch 'master' into fix-argon-initial-display 2023-12-06 09:30:28 +01:00
Salman Ahmed
20fd458fac Perserve miss animation when followed by a hit at same frame 2023-12-05 21:59:28 +03:00
Salman Ahmed
9496cdf42b Add explanatory note for scheduling 2023-12-05 21:59:28 +03:00
Salman Ahmed
927cfe4257 Fix health processor event leaks 2023-12-05 21:59:28 +03:00
Salman Ahmed
629e64d50a Fix ArgonHealthDisplay not displaying miss correctly during initial transition 2023-12-04 23:55:31 +03:00
Salman Ahmed
4d82a55594 Remove method for being unused 2023-12-04 23:24:28 +03:00
Salman Ahmed
5723715ea0 Fix ArgonHealthDisplay sometimes behaving weirdly on miss judgements 2023-12-04 23:24:28 +03:00
Dean Herbert
a4be28a2ae
Don't show buttons on fail overlay when player interaction is disabled 2023-11-27 12:25:24 +09:00
Bartłomiej Dach
98ab9853ce
Merge branch 'master' into show-spectator-fail-2 2023-11-27 12:24:59 +09:00
Bartłomiej Dach
19639de299
Merge branch 'master' into fix-spectator-quit-2 2023-11-27 11:36:10 +09:00
Dean Herbert
7ceb49fbc0
Add extra test coverage and handle case where still at loading screen 2023-11-24 15:05:39 +09:00
Dean Herbert
d3a55d83c0
Schedule FailScore inside onFail instead of onFailComplete 2023-11-24 14:44:57 +09:00
Dean Herbert
ef5dd24589
Update failing test coverage and fix onFail being called too often 2023-11-24 14:44:57 +09:00
Dean Herbert
4ad3cb3b49
Submit and send failed spectator state more aggressively 2023-11-24 14:44:57 +09:00
Dean Herbert
8375dd72d6
Add xmldoc to new AllowFail method 2023-11-24 14:44:57 +09:00
Dean Herbert
ca93fdc94b
Add visualisation of when a spectated player fails
Create a new stack each time for isolation and safety
2023-11-24 14:44:57 +09:00
Dean Herbert
b024065857
Remove implicit schedule of abstract methods in SpectatorScreen
This allows each implementation to have control over scheduling. Without
this, the solo implementation would not be able to handle quit events
while watching a player, as it would push a child (gameplay) screen to
the stack where the `SpectatorScreen` would usually be.
2023-11-24 14:26:09 +09:00
Dean Herbert
335e8efff7
Apply NRT to SoloSpecatorScreen 2023-11-24 14:26:09 +09:00
Dean Herbert
dabbdf674b
Rename SoloSpectator to SoloSpectatorScreen 2023-11-24 14:26:08 +09:00
Dean Herbert
95c00f9666
Add HexaconIcons lookup to allow usage with SpriteIcon 2023-11-24 13:17:39 +09:00
Dean Herbert
5239fee947
Allow use of skin username/flag/avatar components outside of gameplay 2023-11-23 17:15:03 +09:00
yesseruser
82fec4194d Disabled RecievePositionalInputAtSubTree in PlayerFlag. 2023-11-22 15:45:32 +01:00