ppy / osu

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

Crash after update if realm database belongs to a newer version #19216

Open hlysine opened 2 years ago

hlysine commented 2 years ago

Type

Crash to desktop

Bug description

My main lazer installation was at 2022.709.1, then I built and ran master(5b9be3e682649abbdbd5d02edb8f2b8e515e3b92) separately for development. This caused the realm database to migrate to a newer version because the dev build was using the same data folder. When I open my main installation again, it warned me about the newer realm database version and prompted me to restart for the 2022.716.1 update. The first restart after the update crashed, but subsequent restarts run fine.

The relevant stack trace:

2022-07-18 13:21:20 [error]: An unhandled error has occurred.
2022-07-18 13:21:20 [error]: System.IO.IOException: The process cannot access the file 'D:\Games\osu!lazer\data\client.realm' because it is being used by another process.
2022-07-18 13:21:20 [error]: at System.IO.FileSystem.DeleteFile(String fullPath)
2022-07-18 13:21:20 [error]: at System.IO.File.Delete(String path)
2022-07-18 13:21:20 [error]: at osu.Framework.Platform.NativeStorage.Delete(String path)
2022-07-18 13:21:20 [error]: at osu.Game.IO.WrappedStorage.Delete(String path)
2022-07-18 13:21:20 [error]: at osu.Game.Database.RealmAccess.attemptRecoverFromFile(String recoveryFilename)
2022-07-18 13:21:20 [error]: at osu.Game.Database.RealmAccess..ctor(Storage storage, String filename, GameThread updateThread, IDatabaseContextFactory efContextFactory)
2022-07-18 13:21:20 [error]: at osu.Game.OsuGameBase.load(ReadableKeyCombinationProvider keyCombinationProvider)

OS: Windows 11

Screenshots or videos

No response

Version

2022.716.1

Logs

network.log performance.log performance-audio.log performance-draw.log performance-update.log runtime.log updater.log database.log legacy-ipc.log

peppy commented 2 years ago

This is a well known windows file access issue. Any file deletion needs to be tried 100s of times until it works, because windows. Not sure if it deserves a tracking issue. Already aware via multiple sentry reports.