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

Panic when returning Status with arbitrary Bytes in details #342

Closed
dvshur opened this issue May 5, 2020 · 2 comments · Fixed by #345
Closed

Panic when returning Status with arbitrary Bytes in details #342

dvshur opened this issue May 5, 2020 · 2 comments · Fixed by #345
Labels
A-tonic C-bug Category: Something isn't working

Comments

@dvshur
Copy link
Contributor

dvshur commented May 5, 2020

Bug Report

Version

0.2.0

Platform

Mac OS Catalina

Description

I was trying to return a Status with details from an unary RPC call looking like this

Err(Status::with_details(
  Code::ResourceExhausted,
  "Too many requests",
  Bytes::from_static(b"hello"),
))

It panicked with an error:

thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Status { code: Internal, message: "Couldn\'t serialize non-text grpc status header" }', /Users/<usr>/.cargo/registry/src/github.com-1ecc6299db9ec823/tonic-0.2.0/src/server/grpc.rs:225:9

Upon discussing with @LucioFranco in Discord:

  • This is probably due to this validation
  • Since the bytes are going to a *-bin header, they should probably be base64-serialized according to spec.
@LucioFranco
Copy link
Member

The test in #345 should reproduce but it seems to pass

@LucioFranco LucioFranco added C-bug Category: Something isn't working A-tonic labels May 7, 2020
@dvshur
Copy link
Contributor Author

dvshur commented May 7, 2020

Bytes::from_static(&[1]) reproduce the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tonic C-bug Category: Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants