Skip to content

Fix execProtocolRawSync spin after backend exit - #1081

Open
psh4607 wants to merge 5 commits into
electric-sql:mainfrom
psh4607:fix/GH-1058/protocol-backend-exit
Open

Fix execProtocolRawSync spin after backend exit#1081
psh4607 wants to merge 5 commits into
electric-sql:mainfrom
psh4607:fix/GH-1058/protocol-backend-exit

Conversation

@psh4607

@psh4607 psh4607 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

작업 배경

execProtocolRawSync swallowed exceptions from the Postgres WASM main loop unless they matched the database error longjmp sentinel. When the backend exited or crashed mid-message, the input offsets stopped advancing and the synchronous loop retried forever at 100% CPU.

티켓 및 링크

작업 내용

  • Rethrow ExitStatus, RuntimeError, and other exceptions outside the known longjmp recovery path.
  • Preserve the original protocol error when cleanup also fails, while always restoring the host process.exitCode.
  • Add bounded child-process regressions for backend exit with and without an open transaction, synthetic runtime failure, cleanup failure, and child cleanup.
  • Add a patch changeset for @electric-sql/pglite.

테스트

  • pnpm --dir packages/pglite exec vitest run tests/exec-protocol-backend-exit.test.ts tests/exec-protocol.test.ts --reporter=verbose
  • pnpm --dir packages/pglite exec vitest run tests/basic.test.ts --testNamePattern='restores process.exitCode' --reporter=verbose
  • pnpm --dir packages/pglite typecheck
  • pnpm --dir packages/pglite stylecheck

@psh4607
psh4607 marked this pull request as ready for review August 18, 2026 02:24
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.

1 participant