Skip to content

[Bug] netty 3.2.10 that dubbo-remoting-netty currently depended has a known client connect exception issue #15191

Closed
@zrlw

Description

@zrlw

Pre-check

  • I am sure that all the content I provide is in English.

Search before asking

  • I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

Dubbo 3.3

Steps to reproduce this issue

sometimes NettyClientTest failed caused by ClosedChannelException,
https://github.com/zrlw/dubbo/actions/runs/13560156508/job/37902031340

2025-02-27T06:31:39.0584637Z [ERROR] org.apache.dubbo.remoting.transport.netty.NettyClientTest.testClientClose -- Time elapsed: 0.034 s <<< ERROR!
2025-02-27T06:31:39.0586580Z org.apache.dubbo.remoting.RemotingException: client(url: exchange://localhost:32477?client=netty3&codec=exchange) failed to connect to server localhost/127.0.0.1:32477, error message is:null
2025-02-27T06:31:39.0588443Z 	at org.apache.dubbo.remoting.transport.netty.NettyClient.doConnect(NettyClient.java:131)
2025-02-27T06:31:39.0589584Z 	at org.apache.dubbo.remoting.transport.AbstractClient.connect(AbstractClient.java:266)
2025-02-27T06:31:39.0590670Z 	at org.apache.dubbo.remoting.transport.AbstractClient.<init>(AbstractClient.java:93)
2025-02-27T06:31:39.0591731Z 	at org.apache.dubbo.remoting.transport.netty.NettyClient.<init>(NettyClient.java:60)
2025-02-27T06:31:39.0593083Z 	at org.apache.dubbo.remoting.transport.netty.NettyTransporter.connect(NettyTransporter.java:37)
2025-02-27T06:31:39.0594257Z 	at org.apache.dubbo.remoting.Transporter$Adaptive.connect(Transporter$Adaptive.java)
2025-02-27T06:31:39.0595234Z 	at org.apache.dubbo.remoting.Transporters.connect(Transporters.java:66)
2025-02-27T06:31:39.0596358Z 	at org.apache.dubbo.remoting.exchange.support.header.HeaderExchanger.connect(HeaderExchanger.java:43)
2025-02-27T06:31:39.0597551Z 	at org.apache.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:100)
2025-02-27T06:31:39.0598536Z 	at org.apache.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:86)
2025-02-27T06:31:39.0599505Z 	at org.apache.dubbo.remoting.exchange.Exchangers.connect(Exchangers.java:69)
2025-02-27T06:31:39.0600692Z 	at org.apache.dubbo.remoting.transport.netty.NettyClientTest.testClientClose(NettyClientTest.java:81)
2025-02-27T06:31:39.0601760Z 	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
2025-02-27T06:31:39.0602794Z 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
2025-02-27T06:31:39.0603660Z 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
2025-02-27T06:31:39.0604369Z Caused by: java.nio.channels.ClosedChannelException
2025-02-27T06:31:39.0605566Z 	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$1.operationComplete(NioClientSocketPipelineSink.java:157)
2025-02-27T06:31:39.0607076Z 	at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:381)
2025-02-27T06:31:39.0608376Z 	at org.jboss.netty.channel.DefaultChannelFuture.notifyListeners(DefaultChannelFuture.java:367)
2025-02-27T06:31:39.0609568Z 	at org.jboss.netty.channel.DefaultChannelFuture.setSuccess(DefaultChannelFuture.java:316)
2025-02-27T06:31:39.0610809Z 	at org.jboss.netty.channel.AbstractChannel$ChannelCloseFuture.setClosed(AbstractChannel.java:351)
2025-02-27T06:31:39.0611948Z 	at org.jboss.netty.channel.AbstractChannel.setClosed(AbstractChannel.java:188)
2025-02-27T06:31:39.0613299Z 	at org.jboss.netty.channel.socket.nio.NioSocketChannel.setClosed(NioSocketChannel.java:146)
2025-02-27T06:31:39.0614391Z 	at org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:592)
2025-02-27T06:31:39.0615852Z 	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.close(NioClientSocketPipelineSink.java:415)
2025-02-27T06:31:39.0617576Z 	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.processConnectTimeout(NioClientSocketPipelineSink.java:379)
2025-02-27T06:31:39.0619313Z 	at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink$Boss.run(NioClientSocketPipelineSink.java:299)
2025-02-27T06:31:39.0620696Z 	at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
2025-02-27T06:31:39.0621875Z 	at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
2025-02-27T06:31:39.0623343Z 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
2025-02-27T06:31:39.0624615Z 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

this issue had been fixed since netty 3.3.0, see netty/netty#138

NioClientSocketPipelineSink codes snippet of netty 3.3.0 :
https://github.com/netty/netty/blob/netty-3.3.0.Final/src/main/java/org/jboss/netty/channel/socket/nio/NioClientSocketPipelineSink.java

        private void processConnectTimeout(Set<SelectionKey> keys, long currentTimeNanos) {
            ConnectException cause = null;
            for (SelectionKey k: keys) {
                if (!k.isValid()) {
                    // Comment the close call again as it gave us major problems
                    // with ClosedChannelExceptions.
                    //
                    // See:
                    // * https://github.com/netty/netty/issues/142
                    // * https://github.com/netty/netty/issues/138
                    //
                    // close(k);
                    continue;
                }

What you expected to happen

netty version might be upgraded from 3.2.10.Final to 3.3.0.Final at least.

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • Yes I am willing to submit a pull request on my own!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions