Skip to content

gRPC stream accesses broken pipe when using HTTP proxy #236

@HomelessDinosaur

Description

@HomelessDinosaur

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/@grpc+grpc-js@1.10.0/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/@grpc+grpc-js@1.10.0/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/@grpc+grpc-js@1.10.0/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/@grpc+grpc-js@1.10.0/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/@grpc+grpc-js@1.10.0/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/@grpc+grpc-js@1.10.0/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/@nitric+sdk@1.3.3/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/@nitric+sdk@1.3.3/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/@nitric+sdk@1.3.3/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/@nitric+sdk@1.3.3/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/@nitric+sdk@1.3.3/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions