Debug build of lazer crashes on launch when migrating to Realm
See original GitHub issueSteps to repro
- Delete lazer data folder.
- Checkout 2ad0ea35be5c170546b8cfca8f7cae0939567bcd and run that version. (Probably not related to that specific commit, it’s just the commit I happened to be on when I first found the bug.)
- Choose to start fresh at the specified location when prompted.
- Close the game.
- Check out master (at 1a207251628d50ae701ec73a4c47f0f27ca29930 right now) and run the game.
- Game fails to launch with an IOException:
Stack Trace
2022-01-20 13:43:20 [verbose]: Beginning realm file store cleanup
2022-01-20 13:43:20 [verbose]: Finished realm file store cleanup (0 of 0 deleted)
2022-01-20 13:43:21 [important]: Your development database has been fully migrated to realm. If you switch back to a pre-realm branch and need your previous database, rename the backup file back to "client.db".
2022-01-20 13:43:21 [important]:
2022-01-20 13:43:21 [important]: Note that doing this can potentially leave your file store in a bad state.
2022-01-20 13:43:21 [error]: An unhandled error has occurred.
2022-01-20 13:43:21 [error]: System.IO.IOException: The process cannot access the file 'D:\Games\osu!lazer\data\client.db' because it is being used by another process.
2022-01-20 13:43:21 [error]: at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
2022-01-20 13:43:21 [error]: at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
2022-01-20 13:43:21 [error]: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
2022-01-20 13:43:21 [error]: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
2022-01-20 13:43:21 [error]: at System.IO.File.Open(String path, FileMode mode, FileAccess access, FileShare share)
2022-01-20 13:43:21 [error]: at osu.Framework.Platform.NativeStorage.GetStream(String path, FileAccess access, FileMode mode)
2022-01-20 13:43:21 [error]: at osu.Game.IO.WrappedStorage.GetStream(String path, FileAccess access, FileMode mode) in D:\Projects\OSU\osu\osu.Game\IO\WrappedStorage.cs:line 71
2022-01-20 13:43:21 [error]: at osu.Game.Database.DatabaseContextFactory.CreateBackup(String backupFilename) in D:\Projects\OSU\osu\osu.Game\Database\DatabaseContextFactory.cs:line 157
2022-01-20 13:43:21 [error]: at osu.Game.Database.EFToRealmMigrator.ensureBackup() in D:\Projects\OSU\osu\osu.Game\Database\EFToRealmMigrator.cs:line 409
2022-01-20 13:43:21 [error]: at osu.Game.Database.EFToRealmMigrator.migrateBeatmaps(OsuDbContext ef) in D:\Projects\OSU\osu\osu.Game\Database\EFToRealmMigrator.cs:line 80
2022-01-20 13:43:21 [error]: at osu.Game.Database.EFToRealmMigrator.Run() in D:\Projects\OSU\osu\osu.Game\Database\EFToRealmMigrator.cs:line 45
2022-01-20 13:43:21 [error]: at osu.Game.OsuGameBase.load(ReadableKeyCombinationProvider keyCombinationProvider) in D:\Projects\OSU\osu\osu.Game\OsuGameBase.cs:line 198
Here’s how the data folder looks like after the crash: (Backup files are missing)
I can confirm that the migration itself is successful since the game launches just fine if I delete client.db
. Modified settings are still persisted. It is only crashing in the backup creation part.
Logs
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Debug build of lazer crashes on launch when migrating to Realm
Debug build of lazer crashes on launch when migrating to Realm · Summary · Jobs. Check for requests · Run · Run details....
Read more >Crash when starting realm
iOS, Realm 3.17.1. For reasons to long to detail, we had a significant number of users crash during the migration block execution.
Read more >React Native Realm app Crash after release build
I have setup the working example from the @realm/react. In debug mode, it works fine. After i run npx react-native run-android ...
Read more >Lazer 2022.118.0 · changelog - Osu! - ppy
So I got a question about those "Realm" updates. it's a new database format? Do maps get we have already on Lazer ported...
Read more >Realm: create causing a crash within android (react-native)
The example below is working fine while in debug is enabled using React Native Debugger but the app is crashing in normal mode...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not really? The D drive is a Verbatim Vi550 S3 1TB SSD with NTFS file system.
Tested several times. It seems to work reliably now.
I’ve added basic retry logic, please give it another try.