[
https://issues.apache.org/jira/browse/RATIS-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rui Wang updated RATIS-2744:
----------------------------
Description:
When no host is configured, the gRPC and Netty servers build their bind address
with new InetSocketAddress(port), which resolves to the IPv6 wildcard ::. On
machines without IPv6 support, such as the GitHub Actions Ubuntu runners, the
native epoll transport can't bind to that address, so the server fails to start:
```
Caused by: org.apache.ratis.util.ExitUtils$ExitException: Failed to start Grpc
server
at org.apache.ratis.util.ExitUtils.terminate(ExitUtils.java:141)
at org.apache.ratis.util.ExitUtils.terminate(ExitUtils.java:151)
at
org.apache.ratis.grpc.server.GrpcServicesImpl.startImpl(GrpcServicesImpl.java:393)
at
org.apache.ratis.util.LifeCycle.startAndTransition(LifeCycle.java:280)
at
org.apache.ratis.server.RaftServerRpcWithProxy.start(RaftServerRpcWithProxy.java:72)
at
org.apache.ratis.server.impl.RaftServerProxy.startImpl(RaftServerProxy.java:416)
at
org.apache.ratis.util.LifeCycle.startAndTransition(LifeCycle.java:280)
at
org.apache.ratis.server.impl.RaftServerProxy.start(RaftServerProxy.java:409)
at
org.apache.ratis.server.impl.MiniRaftCluster.startServers(MiniRaftCluster.java:466)
at
org.apache.ratis.server.impl.MiniRaftCluster.start(MiniRaftCluster.java:340)
at
org.apache.ratis.server.impl.MiniRaftCluster$Factory$Get.runWithNewCluster(MiniRaftCluster.java:144)
at
org.apache.ratis.server.impl.MiniRaftCluster$Factory$Get.runWithNewCluster(MiniRaftCluster.java:124)
at
org.apache.ratis.datastream.DataStreamCommandE2ETestCases.testStreamCommand(DataStreamCommandE2ETestCases.java:66)
... 3 more
Caused by: java.io.IOException: Failed to bind to address
::/[0:0:0:0:0:0:0:0]:15002
at
org.apache.ratis.thirdparty.io.grpc.netty.NettyServer.start(NettyServer.java:347)
at
org.apache.ratis.thirdparty.io.grpc.internal.ServerImpl.start(ServerImpl.java:187)
at
org.apache.ratis.thirdparty.io.grpc.internal.ServerImpl.start(ServerImpl.java:94)
at
org.apache.ratis.grpc.server.GrpcServicesImpl.startImpl(GrpcServicesImpl.java:391)
... 13 more
Caused by:
org.apache.ratis.thirdparty.io.netty.channel.unix.Errors$NativeIoException:
bind(..) failed with error(-97): Address family not supported by protocol
```
Caused by: NativeIoException: bind(..) failed with error(-97): Address family
not supported by protocol
This stacktrace was discovered in
https://github.com/apache/ratis/actions/runs/36123180483/job/108033212253?pr=1614
This JIRA proposes adding `NetUtils.createBindSocketAddress(String host, int
port)`. It returns 0.0.0.0:port when the host is null or empty, and resolves
the given host otherwise.
was:
When no host is configured, the gRPC and Netty servers build their bind address
with new InetSocketAddress(port), which resolves to the IPv6 wildcard ::. On
machines without IPv6 support, such as the GitHub Actions Ubuntu runners, the
native epoll transport can't bind to that address, so the server fails to start:
```
java.io.IOException: Failed to bind to address ::/[0:0:0:0:0:0:0:0]:15002
at
org.apache.ratis.thirdparty.io.grpc.netty.NettyServer.start(NettyServer.java:347)
at
org.apache.ratis.grpc.server.GrpcServicesImpl.startImpl(GrpcServicesImpl.java:391)
...
```
Caused by: NativeIoException: bind(..) failed with error(-97): Address family
not supported by protocol
This stacktrace was discovered in
https://github.com/apache/ratis/actions/runs/36123180483/job/108033212253?pr=1614
This JIRA proposes adding `NetUtils.createBindSocketAddress(String host, int
port)`. It returns 0.0.0.0:port when the host is null or empty, and resolves
the given host otherwise.
> Bind gRPC and Netty servers to the IPv4 wildcard when no host is configured
> ---------------------------------------------------------------------------
>
> Key: RATIS-2744
> URL: https://issues.apache.org/jira/browse/RATIS-2744
> Project: Ratis
> Issue Type: Improvement
> Components: test
> Reporter: Rui Wang
> Assignee: Rui Wang
> Priority: Major
> Fix For: 3.4.0
>
>
> When no host is configured, the gRPC and Netty servers build their bind
> address with new InetSocketAddress(port), which resolves to the IPv6 wildcard
> ::. On machines without IPv6 support, such as the GitHub Actions Ubuntu
> runners, the native epoll transport can't bind to that address, so the server
> fails to start:
> ```
> Caused by: org.apache.ratis.util.ExitUtils$ExitException: Failed to start
> Grpc server
> at org.apache.ratis.util.ExitUtils.terminate(ExitUtils.java:141)
> at org.apache.ratis.util.ExitUtils.terminate(ExitUtils.java:151)
> at
> org.apache.ratis.grpc.server.GrpcServicesImpl.startImpl(GrpcServicesImpl.java:393)
> at
> org.apache.ratis.util.LifeCycle.startAndTransition(LifeCycle.java:280)
> at
> org.apache.ratis.server.RaftServerRpcWithProxy.start(RaftServerRpcWithProxy.java:72)
> at
> org.apache.ratis.server.impl.RaftServerProxy.startImpl(RaftServerProxy.java:416)
> at
> org.apache.ratis.util.LifeCycle.startAndTransition(LifeCycle.java:280)
> at
> org.apache.ratis.server.impl.RaftServerProxy.start(RaftServerProxy.java:409)
> at
> org.apache.ratis.server.impl.MiniRaftCluster.startServers(MiniRaftCluster.java:466)
> at
> org.apache.ratis.server.impl.MiniRaftCluster.start(MiniRaftCluster.java:340)
> at
> org.apache.ratis.server.impl.MiniRaftCluster$Factory$Get.runWithNewCluster(MiniRaftCluster.java:144)
> at
> org.apache.ratis.server.impl.MiniRaftCluster$Factory$Get.runWithNewCluster(MiniRaftCluster.java:124)
> at
> org.apache.ratis.datastream.DataStreamCommandE2ETestCases.testStreamCommand(DataStreamCommandE2ETestCases.java:66)
> ... 3 more
> Caused by: java.io.IOException: Failed to bind to address
> ::/[0:0:0:0:0:0:0:0]:15002
> at
> org.apache.ratis.thirdparty.io.grpc.netty.NettyServer.start(NettyServer.java:347)
> at
> org.apache.ratis.thirdparty.io.grpc.internal.ServerImpl.start(ServerImpl.java:187)
> at
> org.apache.ratis.thirdparty.io.grpc.internal.ServerImpl.start(ServerImpl.java:94)
> at
> org.apache.ratis.grpc.server.GrpcServicesImpl.startImpl(GrpcServicesImpl.java:391)
> ... 13 more
> Caused by:
> org.apache.ratis.thirdparty.io.netty.channel.unix.Errors$NativeIoException:
> bind(..) failed with error(-97): Address family not supported by protocol
> ```
> Caused by: NativeIoException: bind(..) failed with error(-97): Address family
> not supported by protocol
> This stacktrace was discovered in
> https://github.com/apache/ratis/actions/runs/36123180483/job/108033212253?pr=1614
> This JIRA proposes adding `NetUtils.createBindSocketAddress(String host, int
> port)`. It returns 0.0.0.0:port when the host is null or empty, and resolves
> the given host otherwise.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)