fix(se): handle EOF in stdin - #5486
Merged
Merged
Conversation
Turns out we didn't actually exit when we hit EOF in stdin in the schema engine's RPC server, and just kept sleeping forever instead. This commit changes that to drain the `client_adapter.request_receiver` queue and exit the loop when EOF is encountered. This is important because on Windows we can't use signals for graceful shutdown, so we should do that by closing the stdin pipe. Ref: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
CodSpeed Performance ReportMerging #5486 will not alter performanceComparing Summary
|
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 17, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
Contributor
WASM Query Engine file Size
|
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 17, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
jacek-prisma
approved these changes
Jun 18, 2025
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
that referenced
this pull request
Jun 18, 2025
Turns out we didn't actually exit when we hit EOF in stdin in the schema engine's RPC server, and just kept sleeping forever instead. This commit changes that to drain the `client_adapter.request_receiver` queue and exit the loop when EOF is encountered. This is important because on Windows we can't use signals for graceful shutdown, so we should do that by closing the stdin pipe. Ref: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
aqrln
added a commit
to prisma/prisma
that referenced
this pull request
Jun 18, 2025
Windows doesn't have signals, so calling `this.child?.kill()` immediately terminates the child process without running the graceful shutdown code. We should trigger the graceful shutdown by closing stdin instead. Depends on <prisma/prisma-engines#5486>. Closes: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows
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.
Turns out we didn't actually exit when we hit EOF in stdin in the schema engine's RPC server, and just kept sleeping forever instead.
This commit changes that to drain the
client_adapter.request_receiverqueue and exit the loop when EOF is encountered.This is important because on Windows we can't use signals for graceful shutdown, so we should do that by closing the stdin pipe.
Ref: https://linear.app/prisma-company/issue/ORM-1093/schema-engine-termination-on-windows