Do not cache null values in beatmap lookup cache#37456
Merged
smoogipoo merged 1 commit intoppy:masterfrom Apr 21, 2026
Merged
Conversation
RFC. The reason I'm bringing this up is ppy#37383. In this case, the retrieval of the beatmap failed on a timeout: ``` 2026-04-19 02:43:10 [verbose]: Request to https://osu.ppy.sh/api/v2/beatmaps/?ids[]=5090069 failed with System.Net.WebException: Request to https://osu.ppy.sh/api/v2/beatmaps/?ids[]=5090069 timed out after 10 seconds idle (read 0 bytes, retried 0 times).. 2026-04-19 02:43:10 [verbose]: Failing request osu.Game.Online.API.Requests.GetBeatmapsRequest (System.Net.WebException: Request to https://osu.ppy.sh/api/v2/beatmaps/?ids[]=5090069 timed out after 10 seconds idle (read 0 bytes, retried 0 times).) ``` ``` 2026-04-19 02:43:10 [error]: Failed to load beatmap 5090069 for playlistItem 0. 2026-04-19 02:43:10 [verbose]:⚠️ Failed to load beatmap 5090069 for playlistItem 0. ``` This fails at https://github.com/ppy/osu/blob/0e9664bfdfa69b4b26ff9cf84615c4b83a195a0e/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCard.cs#L167-L171 Just this failing wouldn't cause the game to soft-lock; when I suppress the lookup locally, the game continues as normal. *However*, suppressing the lookup is not the same as the lookup *failing*, because a failed lookup will write a null to the cache, which means that when a beatmap download is initiated later in https://github.com/ppy/osu/blob/1b488949e13568c23faa0d88b18c8036f4a7dbc8/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs#L308-L320 it'll just do nothing and the user will be stuck, even though they could very well attempt to download the beatmap here if the lookup were to succeed on the second go. To a degree changing the whole cache for this could be viewed as the tail wagging the dog, but I think in general caching nulls here seems pretty anti-user. From within the client I would generally not expect very many complete misses when looking up beatmaps. Note that this wouldn't soft-lock the match anymore since ppy/osu-server-spectator#471. It's just another step in making degradation less impactful.
smoogipoo
approved these changes
Apr 21, 2026
22 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
RFC.
The reason I'm bringing this up is #37383.
In this case, the retrieval of the beatmap failed on a timeout:
This fails at
osu/osu.Game/Screens/OnlinePlay/Matchmaking/RankedPlay/Card/RankedPlayCard.cs
Lines 167 to 171 in 0e9664b
Just this failing wouldn't cause the game to soft-lock; when I suppress the lookup locally, the game continues as normal. However, suppressing the lookup is not the same as the lookup failing, because a failed lookup will write a null to the cache, which means that when a beatmap download is initiated later in
osu/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs
Lines 308 to 320 in 1b48894
it'll just do nothing and the user will be stuck, even though they could very well attempt to download the beatmap here if the lookup were to succeed on the second go.
To a degree changing the whole cache for this could be viewed as the tail wagging the dog, but I think in general caching nulls here seems pretty anti-user. From within the client I would generally not expect very many complete misses when looking up beatmaps.
Note that this wouldn't soft-lock the match anymore since ppy/osu-server-spectator#471. It's just another step in making degradation less impactful.