{"record":{"id":"0be2d87015af84d3","repo":"ppy/osu","slug":"attempting-to-block-for-migration-took-too-long","errorCode":null,"errorMessage":"Attempting to block for migration took too long.","messagePattern":"Attempting to block for migration took too long\\.","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"error","filePath":"osu.Game/OsuGameBase.cs","lineNumber":621,"sourceCode":"                bool success = false;\r\n\r\n                Scheduler.Add(() =>\r\n                {\r\n                    try\r\n                    {\r\n                        realmBlocker = realm.BlockAllOperations(\"migration\");\r\n                        success = true;\r\n                    }\r\n                    catch (Exception ex)\r\n                    {\r\n                        Logger.Log($\"Attempting to block all operations failed: {ex}\", LoggingTarget.Database);\r\n                    }\r\n\r\n                    readyToRun.Set();\r\n                }, false);\r\n\r\n                if (!readyToRun.Wait(30000) || !success)\r\n                    throw new TimeoutException(\"Attempting to block for migration took too long.\");\r\n\r\n                bool? cleanupSucceeded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));\r\n\r\n                Logger.Log(@\"Migration complete!\");\r\n                return cleanupSucceeded != false;\r\n            }\r\n            finally\r\n            {\r\n                realmBlocker?.Dispose();\r\n            }\r\n        }\r\n\r\n        protected virtual IBeatmapUpdater CreateBeatmapUpdater() => new BeatmapUpdater(BeatmapManager, difficultyCache, API, Storage);\r\n\r\n        protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager();\r\n\r\n        protected virtual BatteryInfo CreateBatteryInfo() => null;\r\n\r","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/ppy/osu/blob/d9c73e12adff2feaae4a3e158d36fe5883faf6ca/osu.Game/OsuGameBase.cs#L603-L639","documentation":"Thrown as TimeoutException by OsuGameBase when migrating storage: it waits up to 30 seconds for realm.BlockAllOperations to acquire exclusive access. If realm cannot drain its active operations in that window, migration aborts.","triggerScenarios":"readyToRun.Wait(30000) elapses or the block attempt reports failure. A long-running realm write/transaction (background indexing, score import, beatmap processing) prevents BlockAllOperations from running.","commonSituations":"User triggers storage migration while a large import or background task is writing to realm; very large database; a realm operation that deadlocked or never completes.","solutions":["Retry migration when no background imports/processing is running (pause or complete them first).","Identify and fix any realm transaction that runs longer than expected.","On failure the original storage is left intact; the user can restart and retry."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// migration should be initiated when no realm write tasks are active;\n// pause imports/processing before calling Migrate.","typeGuard":null,"tryCatchPattern":"// the caller of Migrate should catch TimeoutException, leave storage intact,\n// and instruct the user to retry once background tasks finish.","preventionTips":["Do not migrate during large imports or background indexing.","Ensure realm transactions are short-lived so BlockAllOperations can drain them.","On failure, the original storage is preserved; restart and retry."],"tags":["realm","migration","storage","timeout","database"],"backgroundTag":null,"analyzedSha":"d9c73e12adff2feaae4a3e158d36fe5883faf6ca","analyzedAt":"2026-08-13T14:12:54.015Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}