Skip to content

Conversation

@grembo
Copy link
Contributor

@grembo grembo commented Feb 3, 2026

Motivation

In case a client disconnects early, setting socket options (nodelay/keepalive) fails and causes warnings. These warnings have little value, given that modifying options on an already broken connection is basically a noop.

This can happen in case of bad connectivity/congestion, but also by design like in haproxy, which "uses RST to close the health check as it free’s[sic!] resources on haproxy and the backend server immediately".

Due to the above we encounter quite some log spam:

WARN tonic::transport::server::incoming:error trying to set TCP_NODELAY: Connection reset by peer (os error 54)
WARN tonic::transport::server::incoming:error trying to set TCP_KEEPALIVE: Connection reset by peer (os error 54)
...

(This is on FreeBSD, hence "os error 54" (ECONNRESET)).

Solution

Do not warn in case setting socket options fails due to the connection being reset by the client.

In case a client disconnects early, setting socket options
(nodelay/keepalive) fails and causes warnings. These warnings
have little value, given that modifying options on an already
broken connection is basically a noop.

This can happen in case of bad connectivity/congestion, but
also by design like in haproxy, which "uses RST to close the
health check as it free’s[sic!] resources on haproxy and the
backend server immediately".

Due to the above we encounter quite some log spam:

    WARN tonic::transport::server::incoming:error trying to
      set TCP_NODELAY: Connection reset by peer (os error 54)
    WARN tonic::transport::server::incoming:error trying to
      set TCP_KEEPALIVE: Connection reset by peer (os error 54)

(This is on FreeBSD, hence "os error 54" (ECONNRESET)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant