Skip to content

fix: reset protocol parser state after malformed messages - #1072

Open
psh4607 wants to merge 1 commit into
electric-sql:mainfrom
psh4607:fix/1052-reset-protocol-parser
Open

fix: reset protocol parser state after malformed messages#1072
psh4607 wants to merge 1 commit into
electric-sql:mainfrom
psh4607:fix/1052-reset-protocol-parser

Conversation

@psh4607

@psh4607 psh4607 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

작업 배경

Malformed backend packets can make protocol decoding throw while the parser still retains the failed buffer. Reusing that parser then prepends the stale bytes to later responses and prevents recovery.

티켓 및 링크

작업 내용

  • Reset retained parser buffer state when internal packet decoding throws, then rethrow the original error.
  • Keep consumer callback errors outside the reset path.
  • Add a regression test that reuses the same parser successfully after a malformed DataRow.
  • Add a patch changeset for @electric-sql/pglite.

테스트

  • pnpm --filter @electric-sql/pg-protocol exec vitest run (81 passed)
  • pnpm --filter @electric-sql/pg-protocol typecheck
  • pnpm --filter @electric-sql/pg-protocol stylecheck

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@psh4607
psh4607 marked this pull request as ready for review August 3, 2026 05:22
@psh4607

psh4607 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

This PR does not modify dependency manifests or lockfiles. The FOSSA findings appear unrelated to the scoped protocol parser recovery change in #1052.

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.

[BUG]: Protocol parser is never reset when parse() throws — one corrupt/truncated response permanently wedges the instance

1 participant