Fix dangling stream readers, serialization bugs, and refactor abort reducer code#1647
Open
karthikscale3 wants to merge 8 commits intopgp/serialize-abort-signalfrom
Open
Fix dangling stream readers, serialization bugs, and refactor abort reducer code#1647karthikscale3 wants to merge 8 commits intopgp/serialize-abort-signalfrom
karthikscale3 wants to merge 8 commits intopgp/serialize-abort-signalfrom
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Contributor
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (73 failed)mongodb-dev (1 failed):
redis-dev (1 failed):
turso-dev (1 failed):
turso (70 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
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.
Description
Follow-up to #1301 (AbortController/AbortSignal serialization).
What changed
Bug fixes:
reviveAbortControllerstarts a stream reader that blocks indefinitely if no abort arrives, causing serverless function timeouts. Introduced an internalABORT_READER_CANCELcontroller that the step handler cancels after the step function returns, racing against the reader to prevent hangs.Requestreducer now only serializes signals tagged withABORT_STREAM_NAME, preventing plain native signals (e.g. fromfetchtimeouts) from creating unnecessary stream infrastructure.is_systemmigration — Added the0010_add_is_system.sqlDrizzle migration and plumbedisSystemthroughsuspension-handler,world-postgres, andworld-localso system hooks are correctly persisted.WorkflowAPIErrorreference in suspension-handler — Replaced non-existentWorkflowAPIError.is(err)withEntityConflictError.is(err) || RunExpiredError.is(err), matching the pattern used everywhere else in the file (renamed in refactor: replace HTTP status code checks with semantic error types #1342).AbortControllerto the workflow VM causedDurableAgent.stream()to enter itssetTimeout-based timeout path, which the VM traps. Addedtypeof setTimeout === 'function'guard so the timeout is only set in contexts where timers are available.Refactors:
reduceAbortWithListener()andreduceAbortBySymbol()helpers, replacing 3x near-identicalAbortController/AbortSignalreducer implementations across external, workflow, and step contexts.getAbortStreamIdFromToken()to derive stream names from hook tokens with proper prefix validation, replacing manualreplace('abrt_', '')+ string concat insuspension-handler.onabortsetter onWorkflowAbortSignal— Matches the nativeAbortSignalAPI contract.reviveAbortSignal()that skips theabort()patching overhead. StoredABORT_READER_CANCELon signals too, fixing a latent bug wherecancelAbortReaderscouldn't clean up standalone signal readers.Tests:
Request.signalstripping.step-handler.test.tsmock to includecancelAbortReaders.