hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
9.8k stars 998 forks source link

http2_keep_alive_interval doesn't work #1725

Closed akiradeveloper closed 3 months ago

akiradeveloper commented 3 months ago

Bug Report

Version

master branch (da482359933f52e84c0263b28a5a83ab1efe6c33)

Platform

$ uname -a
Darwin AkiranoMacBook-Pro.local 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct  9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 x86_64

Crates

Description

I made a reproducer.

https://github.com/akiradeveloper/tonic-hyper10-debug

the test fails with this message

thread 'main' panicked at /Users/akira/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.3.1/src/common/time.rs:37:17:
You must supply a timer.

I expect it to complete without error because it was okay with 0.11.0.

AmeliasCode commented 3 months ago

+1,

Seems to be coming from here: https://github.com/hyperium/hyper/blob/master/src/common/time.rs#L36

I think it can be fixed via https://docs.rs/hyper-util/0.1.5/hyper_util/server/conn/auto/struct.Http2Builder.html#method.timer after this line: https://github.com/hyperium/tonic/blob/da482359933f52e84c0263b28a5a83ab1efe6c33/tonic/src/transport/server/mod.rs#L550

However, I think it also requires an implementation of: https://docs.rs/hyper/1.3.1/hyper/rt/trait.Timer.html

AmeliasCode commented 3 months ago

Oh, there's one already made: https://docs.rs/hyper-util/0.1.5/hyper_util/rt/tokio/struct.TokioTimer.html

AmeliasCode commented 3 months ago

I'll raise a PR with a fix tomorrow if nobody else gets to it first.