ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.32k stars 2.28k forks source link

Beatmaps hidden difficulties show 0 stars #10458

Closed Gabixel closed 4 years ago

Gabixel commented 4 years ago

Describe the bug: (As title) Probably an issue with the dynamic calculation?

Screenshots or videos showing encountered issue: image image image

osu!lazer version: 2020.1009.0

cdwcgt commented 10 months ago

FK4qszAvi5

I asked about this on the discord server but got no response I encountered this problem after a certain lazer version, and it has never been solved.

some beatmapset have current difficulties, but mostly 0* expanded map panel it will give me difficult but cannot sort.

database.log updater.log runtime.log network.log performance.log client.zip

cdwcgt commented 10 months ago

image

diff --git a/osu.Game/BackgroundDataStoreProcessor.cs b/osu.Game/BackgroundDataStoreProcessor.cs
index 90e55dea6d..39abdb0936 100644
--- a/osu.Game/BackgroundDataStoreProcessor.cs
+++ b/osu.Game/BackgroundDataStoreProcessor.cs
@@ -134,18 +134,16 @@ private void processBeatmapSetsWithMissingMetrics()
                 // of other possible ways), but for now avoid queueing if the user isn't logged in at startup.
                 if (api.IsLoggedIn)
                 {
-                    foreach (var b in r.All<BeatmapInfo>().Where(b => b.StarRating < 0 || (b.OnlineID > 0 && b.LastOnlineUpdate == null)))
+                    foreach (var b in r.All<BeatmapInfo>().Where(b => (b.StarRating < 0 || (b.OnlineID > 0 && b.LastOnlineUpdate == null)) && b.BeatmapSet != null))
                     {
-                        Debug.Assert(b.BeatmapSet != null);
-                        beatmapSetIds.Add(b.BeatmapSet.ID);
+                        beatmapSetIds.Add(b.BeatmapSet!.ID);
                     }
                 }
                 else
                 {
-                    foreach (var b in r.All<BeatmapInfo>().Where(b => b.StarRating < 0))
+                    foreach (var b in r.All<BeatmapInfo>().Where(b => b.StarRating < 0 && b.BeatmapSet != null))
                     {
-                        Debug.Assert(b.BeatmapSet != null);
-                        beatmapSetIds.Add(b.BeatmapSet.ID);
+                        beatmapSetIds.Add(b.BeatmapSet!.ID);
                     }
                 }
             });
bdach commented 10 months ago

@cdwcgt you have a single beatmap without a set in your local database. This is not supposed to happen, hence the assertions in the code you have patched above. Since you are capable of writing code, I cannot discount the possibility of this being a data anomaly that you yourself have called into being.

Thus, unless you can replicate a way to create a beatmap without a set via the editor on current master, I don't think we want the patch above until this is proven to be affecting a bigger number of users.

peppy commented 10 months ago

@bdach Weirdly, I've managed to repro the detached-beatmap-from-set thing repro multiple times from a stable import. I haven't had a chance yet to figure out how it happens... but it might be worth guarding defensively against..

I'm not sure if it can help with investigation, but it's also repro on my current database (run with debug and it should hit an assert on startup).

client_36.realm.zip

bdach commented 10 months ago

from a stable import

I wouldn't really expect a stable import to trigger this either, but it may be worth looking into. That said I'm not sure a post-facto broken database is going to help any. Logs from the stable import might. Or a dump of the actual data being imported from stable.

I guess we could add the guard. But I'm loath to do it because things will silently corrupt anyways but in a slightly different way. There's a whole bunch of places that may also blow up on a beatmap with no set.

peppy commented 10 months ago

There's a whole bunch of places that may also blow up on a beatmap with no set.

Agree, but it looks like the aforementioned case is going to be breaking all processing on a hidden background thread. Seems like one we should consider fixing..

peppy commented 10 months ago

Adding a sneaky fix for this one in https://github.com/peppy/osu/commit/0611a1ddc98462af34e6f1820b58dcd231769af5.

bdach commented 10 months ago

bit of a weird place to apply that in but sure.

peppy commented 10 months ago

Dunno, was touching the same class and I kinda want to make this fix happen without much attention for now 😅