[ 
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:

```
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.

  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 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:
> ```
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to