Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gRPC stream accesses broken pipe when using HTTP proxy #236

Open
HomelessDinosaur opened this issue Jan 20, 2025 · 0 comments
Open

gRPC stream accesses broken pipe when using HTTP proxy #236

HomelessDinosaur opened this issue Jan 20, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@HomelessDinosaur
Copy link
Member

Using HTTP proxies with Deno results in an error caused by the gRPC stream accessing a broken pipe. To quote the grpc-node maintainer:

"The problem is that Deno's Http2Session implementation does not emit a close or goaway event when the connection closes or when it receives a GOAWAY, and it does not throw an error when session.request is called after a GOAWAY is received. As a result, gRPC never detects that the session is closed."

This causes a Deno error when building the container with nitric spec or nitric up.

 error: Uncaught (in promise) BadResource: Bad resource ID
    at node:http2:832:35
    at eventLoopTick (ext:core/01_core.js:175:7)

Using GRPC_TRACE=all and GRPC_VERBOSITY=DEBUG, using nitric run, and stopping the application will produce a more explicit reason for the "Bad Resource ID." This is related to the gRPC stream accessing a broken pipe due to the gRPC never detecting that the session is closed.

2025-01-20 16:11:55 D 2025-01-20T05:11:55.227Z | v1.10.0 1 | resolving_call | [1] ended with status: code=13 details="Received RST_STREAM with code 2 triggered by internal client error: stream closed because of a broken pipe"
2025-01-20 16:11:55 An error occurred: Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: stream closed because of a broken pipe
2025-01-20 16:11:55     at callErrorFromStatus (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/call.js:31:19)
2025-01-20 16:11:55     at Object.onReceiveStatus (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/client.js:419:73)
2025-01-20 16:11:55     at Object.onReceiveStatus (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:323:181)
2025-01-20 16:11:55     at file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/resolving-call.js:99:78
2025-01-20 16:11:55     at processTicksAndRejections (ext:deno_node/_next_tick.ts:28:11)
2025-01-20 16:11:55     at runNextTicks (ext:deno_node/_next_tick.ts:75:3)
2025-01-20 16:11:55     at eventLoopTick (ext:core/01_core.js:182:21)
2025-01-20 16:11:55 for call at
2025-01-20 16:11:55     at ServiceClientImpl.makeBidiStreamRequest (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/client.js:403:32)
2025-01-20 16:11:55     at ServiceClientImpl.proxy (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)
2025-01-20 16:11:55     at file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@nitric/sdk/lib/index.js:15446:38
2025-01-20 16:11:55     at Generator.next (<anonymous>)
2025-01-20 16:11:55     at file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@nitric/sdk/lib/index.js:65:61
2025-01-20 16:11:55     at new Promise (<anonymous>)
2025-01-20 16:11:55     at __async (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@nitric/sdk/lib/index.js:49:10)
2025-01-20 16:11:55     at createWorker (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@nitric/sdk/lib/index.js:15439:45)
2025-01-20 16:11:55     at http (file:///tmp/deno-compile-main/app/node_modules/.deno/@[email protected]/node_modules/@nitric/sdk/lib/index.js:15484:3)
2025-01-20 16:11:55     at file:///tmp/deno-compile-main/app/services/api.ts:20:3 {
2025-01-20 16:11:55   code: 13,
2025-01-20 16:11:55   details: "Received RST_STREAM with code 2 triggered by internal client error: stream closed because of a broken pipe",
2025-01-20 16:11:55   metadata: Metadata { internalRepr: Map(0) {}, options: {} }
2025-01-20 16:11:55 }

Relevant Issues:
denoland/deno#26907
grpc/grpc-node#2853

@HomelessDinosaur HomelessDinosaur added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant