Repository navigation
Honor keep-alive configuration in the port-unification server - #16562
Conversation
…n in the port-unification server Apply the existing keep.alive setting to accepted child channels, matching NettyServer and preserving the false default. Related apache#16558.
Cover unspecified, enabled, and disabled ProtocolConfig.keepAlive values using real loopback connections and accepted socket options.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16562 +/- ##
============================================
+ Coverage 59.02% 60.98% +1.96%
- Complexity 15 11760 +11745
============================================
Files 1953 1953
Lines 89284 89286 +2
Branches 13477 13477
============================================
+ Hits 52700 54452 +1752
+ Misses 30877 29249 -1628
+ Partials 5707 5585 -122
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
LGTM. I reverted only the source change to base 1afcdf7883 and ran PortUnificationServerTest: the keepAlive=true case fails (expected: <true> but was: <false>). On the PR head all 4 cases pass. The change matches how NettyServer sets SO_KEEPALIVE, and the default stays false, so only users who explicitly set keep.alive=true see a behavior change.
One note: this PR does not fix the half-open connection problem in #16558. On Linux the default keepalive probe starts only after 7200 seconds, so that issue still needs a separate discussion about heartbeat / idle timeout.
What is the purpose of the change?
Related #16558.
NettyServeralready honors theProtocolConfig.keepAlivesetting (keep.alivein the exported URL), butNettyPortUnificationServerignores it. As a result, explicitly enabling TCP keep-alive has no effect on accepted connections on the port-unification / Triple server path.This change applies the existing setting to
ChannelOption.SO_KEEPALIVEon accepted child channels, preserving the existing default offalse.The regression test builds URL parameters through
ProtocolConfig, opens real loopback connections, and checks the accepted sockets for unspecified, enabled, and disabled keep-alive settings. The enabled case fails on the original implementation.This is a configuration-consistency fix, not a complete solution for half-open connections: it does not change operating-system keep-alive probe timings or introduce an application idle timeout.
Validation
truewas ignored), 0 errors.mvn -pl dubbo-remoting/dubbo-remoting-netty4 -am \ -Dtest=PortUnificationServerTest \ -Dsurefire.failIfNoSpecifiedTests=false testChecklist