PaulTan94 opened a new issue, #14097:
URL: https://github.com/apache/dubbo/issues/14097

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   Dubbo java 3.2
   
   ### Steps to reproduce this issue
   
   1. Improper handling of new channel in NettyConnectionClient which could 
leak to a channel leak in Triple client and server.
   ```java
       @Override
       public void onConnected(Object channel) {
           if (!(channel instanceof io.netty.channel.Channel)) {
               return;
           }
           io.netty.channel.Channel nettyChannel = ((io.netty.channel.Channel) 
channel);
           if (isClosed()) {
               nettyChannel.close();
               if (LOGGER.isDebugEnabled()) {
                   LOGGER.debug(String.format("%s is closed, ignoring connected 
event", this));
               }
               return;
           }
           this.channel.set(nettyChannel);   // should close the old channel 
before setting new channel
           // This indicates that the connection is available.
           if (this.connectingPromise.get() != null) {
               this.connectingPromise.get().trySuccess(CONNECTED_OBJECT);
           }
           nettyChannel.attr(CONNECTION).set(this);
           if (LOGGER.isDebugEnabled()) {
               LOGGER.debug(String.format("%s connected ", this));
           }
       }
   ```
   
   
   ### What you expected to happen
   
   1. Close the old channel before setting new channel
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to