question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debug build of lazer crashes on launch when migrating to Realm

See original GitHub issue

Steps to repro

  1. Delete lazer data folder.
  2. 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.)
  3. Choose to start fresh at the specified location when prompted.
  4. Close the game.
  5. Check out master (at 1a207251628d50ae701ec73a4c47f0f27ca29930 right now) and run the game.
  6. 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) image

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

performance.log runtime.log database.log network.log

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hlysinecommented, Jan 21, 2022

Are you running from a weird file system or hardware?

Not really? The D drive is a Verbatim Vi550 S3 1TB SSD with NTFS file system.

I’ve added basic retry logic, please give it another try.

Tested several times. It seems to work reliably now.

0reactions
peppycommented, Jan 20, 2022

I’ve added basic retry logic, please give it another try.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found