You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/04 18:08:42 UTC

[GitHub] [dubbo] zrlw edited a comment on issue #8676: 获取本机地址的方法可能需要统一

zrlw edited a comment on issue #8676:
URL: https://github.com/apache/dubbo/issues/8676#issuecomment-913015702


   MetricsFilter这个类的getUrl调用NetUtils.getIpByConfig获取地址,如果没有配置DUBBO_IP_TO_BIND参数就取本机地址,然后又按地址名称取IP,本来取本机地址就取到了物理网卡地址了,结果按物理网卡地址对应的网络名又取了一次IP,因为同名的网卡有多个,排第一的是一个virtualbox host-only地址,InetAddress就取头一个返回,搞得MetricsFilterTest测试不通过。
   用户不配置,像MetricsFilterTest测试类做的那样简单取一下NetUtils.getLocalHost()应该就行了,考虑得太多,超过实际需要之后结果就离谱了。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org