STOR-5343: Add unsafe Durable Object eviction for tests#6841
Closed
apeacock1991 wants to merge 1 commit into
Closed
STOR-5343: Add unsafe Durable Object eviction for tests#6841apeacock1991 wants to merge 1 commit into
apeacock1991 wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
Draft
5 tasks
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
|
LGTM |
Add test-only unsafe Durable Object eviction support for workerd. This introduces server-side eviction plumbing that reuses the existing idle eviction path, then exposes it through unsafe.evict(stub, options) and unsafe.evictAllDurableObjects(options). The eviction path waits for live requests to drain, preserves durable storage, and hibernates hibernatable WebSockets by default. Callers can pass options.webSockets = "close" to close hibernatable WebSockets instead while still preserving storage and allowing the actor to be rebuilt on the next request. The implementation respects preventEviction and keeps actor broken-monitoring intact when eviction is skipped because the actor still has active references. The bulk path walks actor facets recursively so evictAllDurableObjects() covers the currently-running actor tree, waits for all sibling evictions before reporting errors, and keeps each eviction coroutine pinned while it can be suspended. Targeted eviction rejects non-Durable Object stubs and rejects objects that have not been instantiated yet, while bulk eviction skips idle/non-running actors. Tests cover storage preservation, in-memory state reset, in-flight requests, concurrent evictions, preventEviction, non-DO inputs, invalid options, bulk eviction, facet recursion, WebSocket hibernation, and WebSocket close mode.
106889c to
9dc0a02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add test-only unsafe Durable Object eviction support for workerd. This introduces server-side eviction plumbing that reuses the existing idle eviction path, then exposes it through unsafe.evict(stub) and unsafe.evictAllDurableObjects().
The eviction path waits for live requests to drain, preserves durable storage, and hibernates hibernatable WebSockets instead of aborting actors. It also respects preventEviction and keeps actor broken-monitoring intact when eviction is skipped because the actor still has active references.
The bulk path walks actor facets recursively so evictAllDurableObjects() covers the currently-running actor tree. Targeted eviction rejects non-Durable Object stubs and rejects objects that have not been instantiated yet, while bulk eviction skips idle/non-running actors.
Tests cover storage preservation, in-memory state reset, in-flight requests, concurrent evictions, preventEviction, non-DO inputs, bulk eviction, and WebSocket hibernation.
Workers SDK PR: cloudflare/workers-sdk#14398