-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Close SocketChannel in TcpNioClientConnectionFactory.buildNewConnection() #9694
Comments
I'm not sure how to test it, by I believe that your observation is correct. |
That's good! |
It seems we can use I believe tests should succeed in an OS-independent manner. However, I found that one of the classes in Spring Integration uses Given that, should I assume that only Unix environments need to be supported? |
Thanks for the explanation ! |
I'd like to add a comment as there seems to be a misunderstanding ! |
Fixes: spring-projects#9694 Issue link: spring-projects#9694 - Add null check before closing socketChannel in catch block - Prevents potential NullPointerException during error handling
Expected Behavior
Current Behavior
TcpNioClientConnectionFactory.buildNewConnection()
attempts to connect,java.net.ConnectException: Connection refused: no further information
is thrown. However, the socket connection is not closed, and the connection retry interval causes the number of sockets to increase indefinitely.singleUse=false
,clientMode=true
, andretryInterval
, the number of open sockets increases indefinitely until the target server is up.Context
socketChannel.close()
in the event of a connection failure would be a good solution, or if I might be misunderstanding the intended behavior ofTcpNioClientConnectionFactory.buildNewConnection()
.The text was updated successfully, but these errors were encountered: