Conversation
We use `try_insert`, which was added in v1.1.0: * hyperium/http#682 ``` error[E0599]: no method named `try_insert` found for mutable reference `&mut HeaderMap` in the current scope --> tonic/src/transport/channel/service/user_agent.rs:44:14 | 42 | if let Ok(Some(user_agent)) = req | _______________________________________- 43 | | .headers_mut() 44 | | .try_insert(USER_AGENT, self.user_agent.clone()) | |_____________-^^^^^^^^^^ | help: there is a method `insert` with a similar name | 44 - .try_insert(USER_AGENT, self.user_agent.clone()) 44 + .insert(USER_AGENT, self.user_agent.clone()) | ``` Co-authored-by: tottoto <tottotodev@gmail.com>
tonic-build: Only has the tranport feature now. It does not have prost or cleanup-markdown. tonic-prost-build: It does not have the prost feature.
## Motivation I recently ran into problems where we accidentally "lost" the tcp_nodelay=true setting, due to refactoring some code to make it easier to test. This caused mysterious 40 ms latency increases. I hope this makes it less likely for others to make this mistake. ## Solution The documentation of the `Server::tcp_nodelay()` function said "Enabled by default", but that was only true when using `Server::builder()`. The `default()` method set this to false. To fix this: * Change Server::default() to set tcp_nodelay: true. * Change Server::builder() to just call Server::default(). * Add a test to verify the settings for nodelay and keepalive. * Document the functions to note that the TCP settings are ignored when using `serve_with_incoming`. `tcp_keepalive` already had this note. I added the same documentation to `tcp_nodelay` and to `serve_with_incoming` so it is less likely to be missed.
Here's how the error looks before this change:
```
status: 'Some resource has been exhausted', self: "h2 protocol error: http2 error"
```
And here it is after:
```
status: 'Some resource has been exhausted', self: "h2 protocol error: http2 error", source: tonic::transport::Error(Transport, hyper::Error(Http2, Error { kind: GoAway(b"ivan_says_hello", ENHANCE_YOUR_CALM, Remote) }))
```
The latter gives the user a lot more context about the issue.
Co-authored-by: tottoto <tottotodev@gmail.com>
…dec/mod.rs (#2468) ## Motivation This commit fixes several documentation issues: 1. Corrected missing backtick in InvalidArgument code formatting in status.rs 2. Fixed "its" to "it's" typo in codec/mod.rs 3. Corrected misleading comment that referred to "encoder" when it should be "decoder" in codec/mod.rs ## Solution Signed-off-by: xibeiyoumian <xibeiyoumian@outlook.com>
… options (#2472) Add two new configuration methods to the Server builder: - `tcp_keepalive_interval()`: Sets TCP_KEEPINTVL socket option - `tcp_keepalive_retries()`: Sets TCP_KEEPCNT socket option These options were already implemented in TcpIncoming but not exposed through the Server builder API. This change allows users to fine-tune TCP keepalive behavior for scenarios like: - Cloud load balancer idle timeout matching - NAT traversal requirements - Faster dead connection detection The new options default to None (system default) and only take effect when tcp_keepalive() is also configured. ## Motivation `TcpIncoming` already supports `with_keepalive_interval()` and `with_keepalive_retries()`, but these are not exposed through the `Server` builder. Users need fine-grained control over TCP keepalive for cloud LB timeout matching and faster dead connection detection. ## Solution Add `tcp_keepalive_interval()` and `tcp_keepalive_retries()` methods to `Server` builder, passing them through to `TcpIncoming` in `bind_incoming()`. Both default to `None` and only take effect when `tcp_keepalive()` is also set. Tests updated accordingly. Co-authored-by: shenghui kevin <shenghuikevin@shenghuideMac-mini.local>
## Motivation fix documentation links for timeout configuration ## Solution
## Motivation remove redundant word in README.md ## Solution Signed-off-by: rocksload <rocksload@outlook.com>
) This patch fixes a bug where the configured max_message_size is not respected when a payload is compressed, leading the possibility of over allocating and exhausting memory over the configured maximum message size when decompressing the message. ## Motivation When compression is enabled, and a compressed message is sent or received, the configured max_message_size (for both clients and servers) is only checked against the compressed message size and that limit is not respected for the resulting uncompressed message, which can lead to resource exhaustion. ## Solution Respect the configured, or default, max_message_size limit while decompressing a message, returning an error if the resultant decompressed message would exceed the limit.
## Motivation `doc_auto_cfg` was merged into `doc_cfg` in rust-lang/rust#138907. ## Solution Replaces `doc_auto_cfg` config with `doc_cfg`. And uses `cargo-docs-rs` to check with the same options used by docs.rs.
Ref: #2500 CI blocked because of `yq` failed to parse manifest with comments in array. Removing the comments from manifest.
- Expose `tcp_keepalive_interval` and `tcp_keepalive_retries` options on Server (#2472) - Allow configuration of `max_local_error_reset_streams` on Server (#2437) - Put source error into the `Display` impl of `Status` (#2417) - `Server::default()` now sets `TCP_NODELAY` to true (#2413) - Respect `max_message_size` when decompressing a message (#2484) - Depend on http at least 1.1.0 (#2426) - Fix documentation links for timeout configuration (#2483) - Fix documentation typos and grammar issues in status.rs and codec/mod.rs (#2468) - Fix labels in `Display for Status` (#2414) - Fix features docs in tonic-build and tonic-prost-build (#2434) - Remove redundant word in tonic-build and tonic-prost-build README (#2425)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.