Skip to content

Conversation

@mikenomitch
Copy link
Contributor

Summary

Not sure if I got the details exactly right, but thought that information on DO shutdown would be useful

Documentation checklist

@github-actions github-actions bot added size/s product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ labels Jan 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/docs/durable-objects/ @elithrar, @vy-ton, @joshthoward, @oxyjun, @lambrospetrou, @mikenomitch, @cloudflare/pcx-technical-writing, @cloudflare/workers-runtime-1


## Shutdown behavior

Durable Objects may occasionally shut down and be replaced with a new instance. This can happen for various reasons, including:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Durable Objects may occasionally shut down and be replaced with a new instance. This can happen for various reasons, including:
Durable Objects will occasionally shut down and objects are restarted, which will run your Durable Object class constructor. This can happen for various reasons, including:


Durable Objects may occasionally shut down and be replaced with a new instance. This can happen for various reasons, including:

- New deployments with code updates
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- New deployments with code updates
- New Worker [deployments](/workers/configuration/versions-and-deployments/) with code updates


- New deployments with code updates
- Updates to the Workers runtime system
- The runtime deciding to move the Durable Object to a different host
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The runtime deciding to move the Durable Object to a different host
- Workers runtime decisions on where to host objects

- Updates to the Workers runtime system
- The runtime deciding to move the Durable Object to a different host

When a Durable Object is shut down, a new instance will come up automatically to handle new requests In-flight requests are handled as follows:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When a Durable Object is shut down, a new instance will come up automatically to handle new requests In-flight requests are handled as follows:
When a Durable Object is shut down, the object instance is automatically restarted and new requests are routed to the new instance. In-flight requests are handled as follows:

Durable Objects may occasionally shut down and be replaced with a new instance. This can happen for various reasons, including:

- New deployments with code updates
- Updates to the Workers runtime system
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Updates to the Workers runtime system
- Lack of requests to an object following the state transitions documented above
- Cloudflare updates to the Workers runtime system


When a Durable Object is shut down, a new instance will come up automatically to handle new requests In-flight requests are handled as follows:

- **HTTP requests**: Requests are allowed to finish for up to 30 seconds. However, if a request attempts to access storage during this grace period, it will be stopped immediately, since storage access is now occurring on the new instance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **HTTP requests**: Requests are allowed to finish for up to 30 seconds. However, if a request attempts to access storage during this grace period, it will be stopped immediately, since storage access is now occurring on the new instance.
- **HTTP requests**: In-flight requests are allowed to finish for up to 30 seconds. However, if a request attempts to access a Durable Object's storage during this grace period, it will be stopped immediately to maintain Durable Objects global uniqueness property.

@joshthoward does this also apply to RPC requests?


When your Durable Object code is updated, your Worker and Durable Objects are released globally in an eventually consistent manner. This will cause a Durable Object to shut down, with the behavior described above. Updates can also create a situation where a request reaches a new version of your Worker in one location, and calls to a Durable Object still running a previous version elsewhere. Refer to [Code updates](/durable-objects/platform/known-issues/#code-updates) for more information about handling this scenario.

### Working without shutdown hooks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this in /durable-objects/best-practices/rules-of-durable-objects/#scheduling-and-lifecycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ size/s

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants