grpc / grpc/grpc

Raising GRPC::InvalidArgument with a non string metadata object hangs/freezes the GRPC Server and makes it unresponsive

Open
#33,172 1 comment 0 reactions 1 assignee Claimed by @apolcyn View on GitHub
kind/bug lang/ruby priority/P2
Dominant language
C++
Stars
45.3k
Forks
11.4k
Avg merge
2d 12h
Merged PRs (30d)
47

Description

### What version of gRPC and what language are you using?

`Ruby 1.50.0`

### What operating system (Linux, Windows,...) and version?

`macOS Ventura / 13.2.1 (22D68)`

### What runtime / compiler are you using (e.g. python version or version of gcc)

```
Ruby: ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin22]
gcc: 14.0.3
```

### What did you do?

Raising an exception of type `GRPC::InvalidArgument.new` with an hash as the metadata argument causes the gRPC server to become unresponsive and freeze. If this same metadata argument is turned into a string using `.to_json` - everything works as expected.

**Freezes:**
```
raise GRPC::InvalidArgument.new('Record invalid', { errors: {} })
```

**Works as expected and doesn't hang:**
```
raise GRPC::InvalidArgument.new('Record invalid', { errors: {}.to_json })
```

### What did you expect to see?

gRPC server to operate as normal and be responsive

### What did you see instead?

gRPC server freezes and hangs with no stacktrace, no error log, nothing.

Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).

See [TROUBLESHOOTING.md](https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md) for how to diagnose problems better.

### Anything else we should know about your project / environment?
Nothing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.