ppy/osu · error · TimeoutException

Attempting to block for migration took too long.

Error message

Attempting to block for migration took too long.

What it means

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.

Solutions

  1. Retry migration when no background imports/processing is running (pause or complete them first).
  2. Identify and fix any realm transaction that runs longer than expected.
  3. On failure the original storage is left intact; the user can restart and retry.
Defensive patterns

Strategy: retry

Validate before calling

// migration should be initiated when no realm write tasks are active;
// pause imports/processing before calling Migrate.

Try / catch

// the caller of Migrate should catch TimeoutException, leave storage intact,
// and instruct the user to retry once background tasks finish.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of ppy/osu@d9c73e12ad (2026-08-13). Data as JSON: /api/errors/0be2d87015af84d3. Report an issue: GitHub.

Appendix: source

Thrown at osu.Game/OsuGameBase.cs:621

                bool success = false;

                Scheduler.Add(() =>
                {
                    try
                    {
                        realmBlocker = realm.BlockAllOperations("migration");
                        success = true;
                    }
                    catch (Exception ex)
                    {
                        Logger.Log($"Attempting to block all operations failed: {ex}", LoggingTarget.Database);
                    }

                    readyToRun.Set();
                }, false);

                if (!readyToRun.Wait(30000) || !success)
                    throw new TimeoutException("Attempting to block for migration took too long.");

                bool? cleanupSucceeded = (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));

                Logger.Log(@"Migration complete!");
                return cleanupSucceeded != false;
            }
            finally
            {
                realmBlocker?.Dispose();
            }
        }

        protected virtual IBeatmapUpdater CreateBeatmapUpdater() => new BeatmapUpdater(BeatmapManager, difficultyCache, API, Storage);

        protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager();

        protected virtual BatteryInfo CreateBatteryInfo() => null;

View on GitHub (pinned to d9c73e12ad)