tommy-ham opened a new issue, #16558:
URL: https://github.com/apache/dubbo/issues/16558

   ### Pre-check
   
   - [x] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   ### Environment
   - Dubbo version: 3.3.6
   - Java: <version>, pure Java API (no Spring)
   - Protocol: `tri` (Triple, HTTP/2), server uses `NettyPortUnificationServer`
   - OS: <e.g. Linux kernel / container>
   
   ### Steps to reproduce this issue
   
   ### Problem
   After a network failure between a client and a Triple provider, the 
server-side socket stays in `ESTABLISHED` indefinitely.
   In our case it remained for 3+ hours, while the socket no longer exists on 
the client side.
   
   ### Findings from reading the source (3.3.6)
   - `NettyPortUnificationServer` only sets these child options: 
`SO_REUSEADDR`, `TCP_NODELAY`, and the allocator. `SO_KEEPALIVE` is not set, so 
OS-level `tcp_keepalive_*` settings have no effect on server sockets.
   - No `IdleStateHandler` is added in the server pipeline of 
`NettyPortUnificationServer` or `TripleHttp2Protocol`.
   - `TriplePingPongHandler` exists only in the client pipeline, so the server 
never sends HTTP/2 PING.
   - As a result, the `heartbeat` / `heartbeat.timeout` parameters do not seem 
to have any effect on the Triple server side. Only `NettyServer` (used by the 
`dubbo` protocol) has an `IdleStateHandler`.
   
   ### How to reproduce
   1. Start a Triple provider and connect a consumer.
   2. Cut the network without closing the connection (e.g. `iptables -A OUTPUT 
-p tcp --dport <port> -j DROP` on the client side).
   3. On the server, run `ss -tn state established '( sport = :<port> )'` and 
observe the connection stays after `heartbeat.timeout`.
   
   ### What you expected to happen
   
   ### Expected behavior
   The Triple server should detect and close dead client connections, e.g. by 
honoring `heartbeat.timeout` (idle detection) and/or enabling `SO_KEEPALIVE` 
(configurable).
   
   ### Anything else
   
   ### Questions
   1. Is this the intended behavior for the Triple server, or a bug/missing 
feature?
   2. Is there a supported configuration to make the Triple server close dead 
connections that I am missing?
   3. Would a PR adding a configurable `SO_KEEPALIVE` and/or an 
`IdleStateHandler` that closes idle channels to `NettyPortUnificationServer` be 
welcome?
   
   ### Workaround we are considering
   Scanning channels via `PortUnificationExchanger.getServers()` and closing 
connections that do not answer an HTTP/2 PING. This relies on internal APIs, so 
an official solution would be preferable.
   
   ### Do you have a (mini) reproduction demo?
   
   - [ ] Yes, I have a minimal reproduction demo to help resolve this issue 
more effectively!
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [ ] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to