Feature Proposal: Two-Phase Application Startup with Deferred Migrations #21987
Replies: 2 comments
-
|
Important scoping note: This proposal applies specifically to unattended upgrades — i.e. when On a normal boot where the database schema is already current, the application starts exactly as it does today — no change in behavior. The two-phase approach only activates when the runtime detects pending migrations during an unattended upgrade, which is the scenario where the current startup pipeline is most fragile. The existing documentation already hints at the problem:
But increasing A two-phase startup that decouples the migration from the ANCM startup pipeline removes this ceiling entirely. The app becomes "live" (serving a maintenance/upgrade-in-progress response) within seconds, and the migration runs to completion in the background regardless of how long it takes. For reference:
|
Beta Was this translation helpful? Give feedback.
-
|
Seems like this fixes it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
The Problem
When running large database migrations on IIS-hosted Umbraco sites, the application can be killed silently before migrations complete.
IIS enforces a
startupTimeLimit(default: 120 seconds) via the ASP.NET Core Module (ANCM). If the application doesn't respond within that window, the process is terminated. Database migrations run synchronously during app startup, blocking the entire pipeline — the app doesn't respond to anything until every migration has finished.Real-World Example
A project upgrading to v17.2.0 with a large content tree — a root node with 70-80k child nodes, each containing a numeric field and an RTE across 10 languages — consistently failed at the same point during the RTE migration. The migration ran fine locally, but on IIS the process was killed before it could complete.
Using diagnostic tooling, the root cause was confirmed: startup time exceeded the 120-second ANCM limit. Increasing
startupTimeLimitto 600 seconds got the migration further, but it appears it could require up to the maximum value of 3600 seconds to fully complete.This is not an edge case. Any Umbraco site with a large content tree doing a major version upgrade (especially ones involving content migrations like the TinyMCE-to-TipTap RTE migration) can hit this. Related issues going back years confirm this is a recurring problem:
RuntimeLevel.Upgrade, labelled as a wishlist item but never implemented.Why This Matters
startupTimeLimitis a workaround, not a solution — and many teams don't know this setting exists or that it's the cause of their failure.Current Workaround
Add a
startupTimeLimitoverride toweb.config:This works, but:
web.configgeneration.Proposed Approach: Two-Phase Startup
Split application startup into two phases:
Phase 1 — Lightweight Shell
startupTimeLimitand health checks).Phase 2 — Background Migration
IHostedService.Architectural Consideration
Today, Umbraco's entire runtime assumes a fully migrated database. Routing, content resolution, backoffice controllers — all of it expects the schema to be in its final state. This means the proposal requires a clear separation between:
This is a meaningful architectural change, but the pattern (sometimes called "startup probes" or "readiness vs. liveness") is well-established in container orchestration and could benefit Umbraco in multiple scenarios beyond migrations (plugin initialization, index rebuilding, cache warming, etc.).
Benefits
Questions for Discussion
References:
startupTimeLimitdocumentationweb.confighosting configurationBeta Was this translation helpful? Give feedback.
All reactions