grpc-node
grpc-node copied to clipboard
grpc-js client hangs when server sends metadata > 64KB
Problem description
When a server responds with headers/trailers exceeding ~64KB, the client hangs (callback is not triggered).
Reproduction steps
- Start a server that adds > 64KB to response headers/trailers.
- Create a client for that service and call it
- --> Client hangs
Here is a test demonstrating the issue
Environment
- OS name, version and architecture: macOS Monterey 12.5.1, Apple M1 Max
- Node version: 16.17.0
- Node installation method: yarn
- Package name and version:
@grpc/[email protected]
Additional context
The issue seems to be related to this on - https://github.com/grpc/grpc-node/issues/1533, though with a bit different setup. That issue had the provided reproduction - those tests pass now(with updated Node/@grpc/grpc-js
versions).
I forked the reproduction repo to update the tests setup:
- new test demonstrates client hanging when server send trailer of ~65KB size.
- lower level Node's HTTP2 test reproduces similar behavior - it hangs (no client-side events fired) on metadata that is > 64KB.
- when metadata exceeding the
maxSendHeaderBlockLength
setting, server throwsframeError
(demonstrated in this test) - but since this change applyingmaxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER
that's not the case with@grpc/grpc-js
anymore
- when metadata exceeding the
If this happens with Node's http2 module without any involvement of gRPC, then it seems like the issue is more suited to the Node repository than to this one.