Closed ZhengweiHou closed 1 year ago
AdaptivePort 的逻辑在com.alipay.sofa.rpc.server.ServerFactory#resolveServerConfig , 可以看下这块代码. 和你理解的应该不太一样.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@OrezzerO
原图的示例就是com.alipay.sofa.rpc.server.ServerFactory#resolveServerConfig 中调用的 NetUtils获取可用端口的逻辑。测试时发生NetUtils通过ServerSocket.bind验证通过的端口却和实际sofa服务启动时生效的端口不一致,简化情景如原始截图发生的情景
Your question
同一台机器启动两个sofa进程,开启端口自适应(AdaptivePort),但是两个进程服务注册端口一致,但实际生效端口不一致。通过验证端口自适应逻辑发现我的机器上![图片](https://user-images.githubusercontent.com/14498342/222075898-cad2518c-0d6b-4a6f-ac81-3336d73f7da5.png)
ServerSocket.bind()
预期结果不一致。详细情况如图所示:Your scenes
describe your use scenes (why need this feature)
Your advice
describe the advice or solution you'd like 这个问题也许是jvm的bug,但是应用有办法屏蔽这个问题吗?
Environment
java -version
):uname -a
):3.8.1
2022.1.3 (Community Edition)