grpc-js client hangs when server sends metadata > 64KB
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### 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](https://github.com/alexandervain/grpc-js-metadata/blob/8d10f6421ff4fd5b517a44e52aa3cd6ea3520f66/test/server.spec.ts#L43) 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/grpc-js@1.8.13`
### 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](https://github.com/hugebdu/grpc-js-metadata/blob/master/test/server.spec.ts) - those tests pass now(with updated Node/`@grpc/grpc-js` versions).
I forked the reproduction repo to update the [tests](https://github.com/alexandervain/grpc-js-metadata/blob/master/test/server.spec.ts#L43) setup:
- [new test](https://github.com/alexandervain/grpc-js-metadata/blob/8d10f6421ff4fd5b517a44e52aa3cd6ea3520f66/test/server.spec.ts#L43) demonstrates client hanging when server send trailer of ~65KB size.
- lower level Node's HTTP2 [test](https://github.com/alexandervain/grpc-js-metadata/blob/8d10f6421ff4fd5b517a44e52aa3cd6ea3520f66/test/http2.spec.ts#L71) reproduces similar behavior - it hangs (no client-side events fired) on metadata that is > 64KB.
- when metadata exceeding the `maxSendHeaderBlockLength` setting, server throws `frameError` (demonstrated in this [test](https://github.com/alexandervain/grpc-js-metadata/blob/8d10f6421ff4fd5b517a44e52aa3cd6ea3520f66/test/http2.spec.ts#L58)) - but since [this change](https://github.com/grpc/grpc-node/pull/1571) applying `maxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER` that's not the case with `@grpc/grpc-js` anymore
Contributor guide
Assessment
This issue has not been assessed yet.