Skip to content

fix(deps): update dependency io.netty:netty-transport-native-epoll to v4.2.2.final #1321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion providers/flagd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<!-- we only support unix sockets on linux, via epoll native lib -->
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.1.119.Final</version>
<version>4.2.2.Final</version>
<!-- TODO: with 5+ (still alpha), arm is support and we should package multiple versions -->
<classifier>linux-x86_64</classifier>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import io.grpc.Status.Code;
import io.grpc.netty.GrpcSslContexts;
import io.grpc.netty.NettyChannelBuilder;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.epoll.EpollDomainSocketChannel;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollIoHandler;
import io.netty.channel.unix.DomainSocketAddress;
import io.netty.handler.ssl.SslContextBuilder;
import java.io.File;
Expand Down Expand Up @@ -103,10 +104,9 @@ public static ManagedChannel nettyChannel(final FlagdOptions options) {
if (!Epoll.isAvailable()) {
throw new IllegalStateException("unix socket cannot be used", Epoll.unavailabilityCause());
}

return NettyChannelBuilder.forAddress(new DomainSocketAddress(options.getSocketPath()))
.keepAliveTime(keepAliveMs, TimeUnit.MILLISECONDS)
.eventLoopGroup(new EpollEventLoopGroup())
.eventLoopGroup(new MultiThreadIoEventLoopGroup(EpollIoHandler.newFactory()))
.channelType(EpollDomainSocketChannel.class)
.usePlaintext()
.defaultServiceConfig(SERVICE_CONFIG_WITH_RETRY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
import io.grpc.ManagedChannel;
import io.grpc.netty.GrpcSslContexts;
import io.grpc.netty.NettyChannelBuilder;
import io.netty.channel.IoHandlerFactory;
import io.netty.channel.MultiThreadIoEventLoopGroup;
import io.netty.channel.epoll.Epoll;
import io.netty.channel.epoll.EpollDomainSocketChannel;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.epoll.EpollIoHandler;
import io.netty.channel.unix.DomainSocketAddress;
import io.netty.handler.ssl.SslContextBuilder;
import java.io.File;
Expand All @@ -44,10 +46,12 @@ class ChannelBuilderTest {
@EnabledOnOs(OS.LINUX)
void testNettyChannel_withSocketPath() {
try (MockedStatic<Epoll> epollMock = mockStatic(Epoll.class);
MockedStatic<EpollIoHandler> nativeMock = mockStatic(EpollIoHandler.class);
MockedStatic<NettyChannelBuilder> nettyMock = mockStatic(NettyChannelBuilder.class)) {

// Mocks
epollMock.when(Epoll::isAvailable).thenReturn(true);
nativeMock.when(EpollIoHandler::newFactory).thenReturn(mock(IoHandlerFactory.class));
NettyChannelBuilder mockBuilder = mock(NettyChannelBuilder.class);
ManagedChannel mockChannel = mock(ManagedChannel.class);

Expand All @@ -56,7 +60,8 @@ void testNettyChannel_withSocketPath() {
.thenReturn(mockBuilder);

when(mockBuilder.keepAliveTime(anyLong(), any(TimeUnit.class))).thenReturn(mockBuilder);
when(mockBuilder.eventLoopGroup(any(EpollEventLoopGroup.class))).thenReturn(mockBuilder);
when(mockBuilder.eventLoopGroup(any(MultiThreadIoEventLoopGroup.class)))
.thenReturn(mockBuilder);
when(mockBuilder.channelType(EpollDomainSocketChannel.class)).thenReturn(mockBuilder);
when(mockBuilder.defaultServiceConfig(any())).thenReturn(mockBuilder);
when(mockBuilder.maxRetryAttempts(anyInt())).thenReturn(mockBuilder);
Expand All @@ -77,7 +82,7 @@ void testNettyChannel_withSocketPath() {
assertThat(channel).isEqualTo(mockChannel);
nettyMock.verify(() -> NettyChannelBuilder.forAddress(new DomainSocketAddress("/path/to/socket")));
verify(mockBuilder).keepAliveTime(1000, TimeUnit.MILLISECONDS);
verify(mockBuilder).eventLoopGroup(any(EpollEventLoopGroup.class));
verify(mockBuilder).eventLoopGroup(any(MultiThreadIoEventLoopGroup.class));
verify(mockBuilder).channelType(EpollDomainSocketChannel.class);
verify(mockBuilder).usePlaintext();
verify(mockBuilder).build();
Expand All @@ -88,10 +93,12 @@ void testNettyChannel_withSocketPath() {
@EnabledOnOs(OS.LINUX)
void testNettyChannel_withSocketPath_withRetryPolicy() {
try (MockedStatic<Epoll> epollMock = mockStatic(Epoll.class);
MockedStatic<EpollIoHandler> nativeMock = mockStatic(EpollIoHandler.class);
MockedStatic<NettyChannelBuilder> nettyMock = mockStatic(NettyChannelBuilder.class)) {

// Mocks
epollMock.when(Epoll::isAvailable).thenReturn(true);
nativeMock.when(EpollIoHandler::newFactory).thenReturn(mock(IoHandlerFactory.class));
NettyChannelBuilder mockBuilder = mock(NettyChannelBuilder.class);
ManagedChannel mockChannel = mock(ManagedChannel.class);

Expand All @@ -100,7 +107,8 @@ void testNettyChannel_withSocketPath_withRetryPolicy() {
.thenReturn(mockBuilder);

when(mockBuilder.keepAliveTime(anyLong(), any(TimeUnit.class))).thenReturn(mockBuilder);
when(mockBuilder.eventLoopGroup(any(EpollEventLoopGroup.class))).thenReturn(mockBuilder);
when(mockBuilder.eventLoopGroup(any(MultiThreadIoEventLoopGroup.class)))
.thenReturn(mockBuilder);
when(mockBuilder.channelType(EpollDomainSocketChannel.class)).thenReturn(mockBuilder);
when(mockBuilder.defaultServiceConfig(ChannelBuilder.SERVICE_CONFIG_WITH_RETRY))
.thenReturn(mockBuilder);
Expand All @@ -121,7 +129,7 @@ void testNettyChannel_withSocketPath_withRetryPolicy() {
assertThat(channel).isEqualTo(mockChannel);
nettyMock.verify(() -> NettyChannelBuilder.forAddress(new DomainSocketAddress("/path/to/socket")));
verify(mockBuilder).keepAliveTime(1000, TimeUnit.MILLISECONDS);
verify(mockBuilder).eventLoopGroup(any(EpollEventLoopGroup.class));
verify(mockBuilder).eventLoopGroup(any(MultiThreadIoEventLoopGroup.class));
verify(mockBuilder).channelType(EpollDomainSocketChannel.class);
verify(mockBuilder).defaultServiceConfig(ChannelBuilder.SERVICE_CONFIG_WITH_RETRY);
verify(mockBuilder).usePlaintext();
Expand Down