Fix failed SQLite payload commit cleanup; document remaining OOM recovery - #65
Draft
marcobambini wants to merge 4 commits into
Draft
marcobambini wants to merge 4 commits into
marcobambini wants to merge 4 commits into
Conversation
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.
Payload apply can return a deferred foreign-key or busy-commit error while leaving its internally opened SQLite transaction active. Uncommitted rows remain visible and a later
BEGINfails.This change centralizes error cleanup, rolls back a failed transaction only when apply started it from autocommit mode, preserves the original error and committed prefixes, and excludes rolled-back rows from applied statistics. It also rejects a failed group-savepoint open and fixes a primary-key-name allocation leak found by fault injection. Caller-owned transactions remain under the caller's control.
Validation
Why this is a draft
The associated engine-level OOM issue from the report is not fully fixed. The allocation sweep covers indices 0–347 and now reports zero leaks and zero failed retries after explicit recovery, but 126 attempts still leave a transaction open. SQLite rejects reentrant cleanup SQL while its outer SQL function is executing with a malloc-failed/interrupted connection. A complete solution needs host-side recovery or a change to the SQL apply execution model. The ASan/UBSan sweep reaches index 351 with 128 open transactions, zero leaks, zero failed retries after recovery and no sanitizer diagnostics; allocation positions depend on the build. The diagnostic
test/stress/payload_oom.cdeliberately exits nonzero for those remaining failures; it is not represented as a passing test.docs/internal/apply-transaction-cleanup.mddocuments the fix, reproduction command, results and remaining recovery requirement.This is one of three independent follow-ups to #64, based on
pg-fixes11092026at9d0abb3. Retarget tomainafter #64 merges. No live cloud endpoint was used or modified.Cloud integration reliability
The shared chunked-tenant job is serialized across branches with a queued concurrency group. This prevents a different PR from writing during the negative-cache test's required idle phase; all idle assertions remain intact, and other platforms still run in parallel.
Fresh receivers now wait for actual received rows and expected fixture data rather than requiring the first poll to contain rows. Polling is bounded and SQL/protocol failures abort immediately. A materialized result ensures one network call per attempt. The offline
integration_bootstraptest runs as part ofmake unittest, covering 312 scenarios including delayed/partial delivery, timeout, missing data, protocol errors and malformed responses. Local ordinary and ASan/UBSan runs pass with zero outstanding SQLite memory.Latest CI verification
Workflow run 35443339032 completed successfully on
a35c0eb: 37 jobs passed, with only the release job skipped. The real-cloud negative-cache test ran and passed on Linux x86_64.