Refreshing a connection no longer crashes the session with large catalogs - #9
Merged
Merged
Conversation
…on in the org listOperations read every stored OpenAPI operation row for all integrations and schema-decoded each binding just to read its integration. With a large catalog such as the Cloudflare API (about 2,700 operations) that allocated over 200 MB per refresh, and the second refresh in a session isolate crossed the Durable Object memory limit, surfacing as "Execution lost: the session was reset". Plugin storage list now pushes keyPrefix into SQL, and the store lists only the current and legacy key prefixes for the integration, decoding bindings of matching rows once. Claude-Session: https://claude.ai/code/session_01VMqJkxznzTQaFVHHcttxpJ
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.
What users saw
Refreshing a connection (for example Google Sheets) failed about every second time with "Execution lost: the session was reset". The session Durable Object was hitting its memory limit (
exceededMemoryin Workers telemetry).Cause
listOperations(integration)in the OpenAPI store read every stored operation row for every integration in the org, and schema-decoded each binding only to read its integration. With the Cloudflare API connection (about 2,700 operations) that allocated over 200 MB per refresh of an unrelated 17-operation connection. The second refresh in a session isolate crossed the 128 MB limit.Change
listpusheskeyPrefixinto SQL (starts with) instead of loading the whole collection and filtering in JS. The JS prefix check stays as the exact filter.Verified in production
Deployed from the diagnostic branch. Four consecutive Sheets refreshes in the same isolate all succeeded (before: the second always failed). CPU per refresh dropped from about 1.2 to 2.9 s to 250 to 400 ms.
https://claude.ai/code/session_01VMqJkxznzTQaFVHHcttxpJ