osu/osu.Game
Dean Herbert 2b578e97e5 Fix deadlock scenario when calculating fallback difficulty
The previous code would run a calcaulation for the beatmap's own ruleset
if the current one failed. While this does make sense, with the current
way we use this component (and the implementation flow) it is quite unsafe.

The to the call on `.Result` in the `catch` block, this would 100%
deadlock due to the thread concurrency of the `ThreadedTaskScheduler`
being 1. Even if the nested run could be run inline (it should be), the
task scheduler won't even get to the point of checking whether this is
feasible due to it being saturated by the already running task.

I'm not sure if we still need this fallback lookup logic. After removing
it, it's feasible that 0 stars will be returned during the scenario that
previously caused a deadlock, but I don't necessarily think this is
incorrect. There may be another reason for this needing to exist which
I'm not aware of (diffcalc?) but if that's the case we may want to move
the try-catch handling to the point of usage.

To reproduce the deadlock scenario with 100% success (the repro
instructions in the linked issue aren't that simple and require some
patience and good timing), the main portion of the lookup can be changed
to randomly trigger a nested lookup:

```
if (RNG.NextSingle() > 0.5f)
    return GetAsync(new
DifficultyCacheLookup(key.Beatmap, key.Beatmap.Ruleset,
key.OrderedMods)).Result;
else
    return new StarDifficulty(attributes);
```

After switching beatmap once or twice, pausing debug and viewing the
state of threads should show exactly what is going on.
2021-01-15 15:19:12 +09:00
..
Audio
Beatmaps Fix deadlock scenario when calculating fallback difficulty 2021-01-15 15:19:12 +09:00
Collections
Configuration Start with null last hover playback time 2021-01-08 18:16:03 +01:00
Database Update KeyBinding usages in line with interface changes 2021-01-15 14:57:01 +09:00
Extensions Catch multiplayer client-related unobserved exceptions better 2020-12-31 11:39:42 +01:00
Graphics Rename download state Downloaded to Importing 2021-01-13 18:04:53 +03:00
Input Update KeyBinding usages in line with interface changes 2021-01-15 14:57:01 +09:00
IO Merge branch 'master' into fix-legacy-skin-texture-loader-store 2020-12-22 12:09:35 +09:00
IPC
Migrations
Online Fix stupid mistake 2021-01-13 22:35:21 +03:00
Overlays Rename download state Downloaded to Importing 2021-01-13 18:04:53 +03:00
Properties
Replays
Rulesets Fix default judgement text mispositioned for one frame 2021-01-14 12:33:33 +09:00
Scoring
Screens Fix unstable multiplayer room ordering when selection is made 2021-01-15 15:19:12 +09:00
Skinning Annotate potentially null parameters in protected ctor of LegacySkin 2020-12-22 12:08:40 +09:00
Storyboards Remove unused using 2021-01-04 15:40:22 +09:00
Tests Merge branch 'master' into user-beatmap-downloading-states 2021-01-13 22:31:31 +03:00
Updater
Users Move load-complete fade specification inside 2020-12-26 14:35:14 +01:00
Utils
osu!.res
osu.Game.csproj Remove unnecessary workaround (mentioned package is pinned by SignalR to a working version) 2021-01-15 15:01:16 +09:00
OsuGame.cs Merge branch 'master' into tourney-switching-ui 2021-01-10 17:33:52 +01:00
OsuGameBase.cs Merge branch 'master' into tourney-switching-ui 2020-12-26 15:45:29 +01:00
PerformFromMenuRunner.cs Inline complete method as well 2020-12-31 10:27:42 +01:00