Skip to content

fix: evict workflows without DestructMemorizedInstanceException - #852

Open
xepozz wants to merge 4 commits into
masterfrom
fix/issue-507-attempt-6
Open

xepozz wants to merge 4 commits into
masterfrom
fix/issue-507-attempt-6

Conversation

@xepozz

@xepozz xepozz commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

What was changed

On eviction, finally blocks run in replay mode and send no commands, without the exception. Pending promises resolve to an internal sentinel, so no user callback or canceller runs and the instance is freed without the GC.

Why?

User catch blocks catch the eviction exception and run code on a dead workflow. The instance also waits in memory for the cycle collector.

Checklist

  1. Closes Eliminate DestructMemorizedInstanceException #507

  2. How was this tested:
    Unit specs for eviction (DestroyWorkflowTestCase, EvictionBatchTestCase, EvictionGarbageTestCase) and the real-server EvictionTest.

  3. Any docs updates needed?
    No. FeatureFlags::$throwDestructMemorizedInstanceException is now @deprecated and is no longer used. The removed exception class was @internal.

WorkerFactoryMock emits ON_FINALLY like WorkerFactory::tick, so DestroyWorkflow runs in unit tests.
…tion

Eviction runs finally blocks in replay mode and sends no commands. Pending promise graphs are settled with the Abandoned sentinel, so no user callback runs. The process is freed without the cycle collector. The feature flag stays deprecated for BC.
@xepozz
xepozz marked this pull request as ready for review November 12, 2026 14:33
@xepozz
xepozz requested review from a team, roxblnfk and wolfy-j as code owners November 12, 2026 14:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T14:37:14.249520Z 3d53e56 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eliminate DestructMemorizedInstanceException

2 participants