Fix initdb in sandboxed Node runtimes - #1099
Closed
psh4607 wants to merge 2 commits into
Closed
Conversation
psh4607
marked this pull request as ready for review
August 25, 2026 02:45
Collaborator
|
I've taken a different approach, emscripten generated code should not set process.exitCode anymore. |
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.
작업 배경
Node 형태의
process를 노출하지만exitCodesetter가 쓰기를 거부하는 sandbox runtime에서 정상적인 initdb 종료가 Emscriptenquit_의process.exitCode쓰기로 실패했습니다.티켓 및 링크
작업 내용
initdb.callMain()동안 writableexitCode를 가진 delegating process shim을 사용하고, 호출 후 원래 process를 복원합니다.process.exitCode를 덮어쓰지 않도록 호출 후 값을 복원합니다._emscripten_force_exit(0)의 예상ExitStatus(0)throw 이후에도 Postgres module 참조를 해제합니다.@electric-sql/pglitepatch changeset을 추가합니다.테스트
pnpm --dir packages/pglite buildpnpm --dir packages/pglite exec vitest run tests/sandboxed-exit-code.test.ts --reporter=verbose(3 passed)pnpm --dir packages/pglite test(297 passed, 1 skipped)pnpm --dir packages/pglite typecheckpnpm --dir packages/pglite stylecheckgit diff --check