Skip to content

Fix flaky tests due to async disposal #33906

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
merged 1 commit into from
Jun 28, 2025

Conversation

smoogipoo
Copy link
Contributor

@smoogipoo smoogipoo commented Jun 27, 2025

See: https://github.com/ppy/osu/actions/runs/15921735738/job/44909862713?pr=33904

I ran a large subset of tests and found one other case where this could come up (relax mod tests). These are cases where hitobjects/beatmaps are reused between tests, which thankfully isn't common to do.

Repro:

diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs
index 6ee3ed13a0..778709ca95 100644
--- a/osu.Game/Screens/Play/Player.cs
+++ b/osu.Game/Screens/Play/Player.cs
@@ -1164,6 +1164,12 @@ public override void OnSuspending(ScreenTransitionEvent e)
             base.OnSuspending(e);
         }
 
+        protected override void Dispose(bool isDisposing)
+        {
+            Thread.Sleep(1000);
+            base.Dispose(isDisposing);
+        }
+
         public override bool OnExiting(ScreenExitEvent e)
         {
             screenSuspension?.RemoveAndDisposeImmediately();

@smoogipoo smoogipoo force-pushed the fix-intermittent-test branch from f451b17 to c53a7aa Compare June 27, 2025 10:43
@peppy peppy merged commit 1e21706 into ppy:master Jun 28, 2025
9 checks passed
@peppy peppy deleted the fix-intermittent-test branch June 28, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants