wozhenbang2004 opened a new pull request, #16562:
URL: https://github.com/apache/dubbo/pull/16562
## What is the purpose of the change?
Related #16558.
`NettyServer` already honors the `ProtocolConfig.keepAlive` setting
(`keep.alive` in the exported URL), but `NettyPortUnificationServer` ignores
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_KEEPALIVE` on
accepted child channels, preserving the existing default of `false`.
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
- Original implementation: 4 tests, 1 failure (`true` was ignored), 0 errors.
- Patched implementation: 4 tests, 0 failures/errors.
- Project Spotless checks pass.
- A broader 15-test selection passed 13 tests; two existing connection tests
were blocked by non-loopback network access in the execution environment. Both
errors were reproduced on the unmodified base revision. The broader run used
the existing Byte Buddy dependency as a startup agent because this environment
does not support Mockito self-attachment.
```sh
mvn -pl dubbo-remoting/dubbo-remoting-netty4 -am \
-Dtest=PortUnificationServerTest \
-Dsurefire.failIfNoSpecifiedTests=false test
```
## Checklist
- [x] Linked the related GitHub issue.
- [x] Described what changes, how, and why.
- [x] Added a regression test covering enabled, disabled, and default
behavior.
- [ ] GitHub Actions results pending.
--
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]