You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@seata.apache.org by "ptyin (via GitHub)" <gi...@apache.org> on 2024/01/24 03:29:50 UTC
[I] Occasional Java UnknownHostException at pod startup [incubator-seata-k8s]
ptyin opened a new issue, #12:
URL: https://github.com/apache/incubator-seata-k8s/issues/12
Pods managed by seata-server StatefulSet sometimes fail to start. The detail error stack is as follow:
```
java.lang.RuntimeException: java.net.UnknownHostException: seata-server-0.seata-server-cluster: Name or service not known
at io.seata.common.util.NetUtil.convertIpIfNecessary(NetUtil.java:330)
at io.seata.common.util.NetUtil.isValidIp(NetUtil.java:309)
at io.seata.server.Server.start(Server.java:68)
at io.seata.server.ServerRunner.run(ServerRunner.java:60)
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:765)
at org.springframework.boot.SpringApplication.lambda$callRunners$2(SpringApplication.java:749)
at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:357)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:483)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485)
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:744)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289)
at io.seata.server.ServerApplication.main(ServerApplication.java:30)
Caused by: java.net.UnknownHostException: seata-server-0.seata-server-cluster: Name or service not known
at java.net.Inet4AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1330)
at java.net.InetAddress.getAllByName0(InetAddress.java:1283)
at java.net.InetAddress.getAllByName(InetAddress.java:1199)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at java.net.InetAddress.getByName(InetAddress.java:1077)
at io.seata.common.util.NetUtil.convertIpIfNecessary(NetUtil.java:328)
... 18 common frames omitted
```
The underlying reason is that seata-server would call `NetUtil.convertIpIfNecessary` method to translate host name of the headless service subdomain, e.g., "seata-server-0.seata-server-cluster". However, the coredns service may not add the service name registry yet, leading to the occasional `UnknownHostException`.
--
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: dev-unsubscribe@seata.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org
Re: [I] Occasional Java UnknownHostException at pod startup [incubator-seata-k8s]
Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan commented on issue #12:
URL: https://github.com/apache/incubator-seata-k8s/issues/12#issuecomment-1909113224
```
private static String convertIpIfNecessary(String ip) {
if (isValidIPv4(ip) || isValidIPv6(ip)) {
return ip;
} else {
try {
return InetAddress.getByName(ip).getHostAddress();
} catch (UnknownHostException e) {
throw new RuntimeException(e);
}
}
}
```
如果ip是一个合法的ipv4/ipv6,这里是不会去转换的。可以提供一下你pod的ip具体是什么,看看是不是之前还没有支持ipv6的版本。之前的这里没有支持ipv6,就会走下面
If the IP is a valid IPv4/IPv6 address, there will be no conversion here. Can you provide the specific IP of your pod to see if the previous version does not support IPv6? The previous version did not support IPv6 here, so it will proceed as follows.
--
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: dev-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org
Re: [I] Occasional Java UnknownHostException at pod startup [incubator-seata-k8s]
Posted by "leizhiyuan (via GitHub)" <gi...@apache.org>.
leizhiyuan closed issue #12: Occasional Java UnknownHostException at pod startup
URL: https://github.com/apache/incubator-seata-k8s/issues/12
--
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: dev-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org
Re: [I] Occasional Java UnknownHostException at pod startup [incubator-seata-k8s]
Posted by "ptyin (via GitHub)" <gi...@apache.org>.
ptyin commented on issue #12:
URL: https://github.com/apache/incubator-seata-k8s/issues/12#issuecomment-1909226741
> The underlying reason is that seata-server would call `NetUtil.convertIpIfNecessary` method to translate host name of the headless service subdomain, e.g., "seata-server-0.seata-server-cluster". However, the coredns service may not add the service name registry yet, leading to the occasional `UnknownHostException`.
The SEATA_IP is the host name of the headless service subdomain, e.g., "seata-server-0.seata-server-cluster". It is a DNS resolution error. The actual underlying reason is the server starts up before Kubernetes coredns adding the "seata-server-0.seata-server-cluster" registry, leading to the occasional UnknownHostException.
It is a bug though. I will provide a PR to fix it.
--
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: dev-unsubscribe@seata.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@seata.apache.org
For additional commands, e-mail: dev-help@seata.apache.org