-
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
TCP/IP: The cached connections are not freed when used with collaborating channel adapters on the client side #9430
Comments
… adapters Fixes: spring-projects#9430 When `CachingClientConnectionFactory` is used in combination of `Tcp.outboundAdapter()` & `Tcp.inboundAdapter()`, the connection is not released back to the cache because `CachingClientConnectionFactory` does not store created connections into its `connections` property. So, when `TcpReceivingChannelAdapter` calls `this.clientConnectionFactory.closeConnection(connectionId);` it returned immediately because there is nothing to remove from the `this.connections` * Add `protected removeConnection()` in the `AbstractConnectionFactory` and override it in the `CachingClientConnectionFactory` with delegation to the `this.targetConnectionFactory` * Demonstrate the problem in the new `IpIntegrationTests.allRepliesAreReceivedViaLimitedCachingConnectionFactory()` test and ensure that all 27 letters from English alphabet are sent to the server and received in uppercase while size of the `CachingClientConnectionFactory` is only `10` **Auto-cherry-pick to `6.3.x` & `6.2.x`**
Fixes: #9430 When `CachingClientConnectionFactory` is used in combination of `Tcp.outboundAdapter()` & `Tcp.inboundAdapter()`, the connection is not released back to the cache because `CachingClientConnectionFactory` does not store created connections into its `connections` property. So, when `TcpReceivingChannelAdapter` calls `this.clientConnectionFactory.closeConnection(connectionId);` it returned immediately because there is nothing to remove from the `this.connections` * Add `protected removeConnection()` in the `AbstractConnectionFactory` and override it in the `CachingClientConnectionFactory` with delegation to the `this.targetConnectionFactory` * Demonstrate the problem in the new `IpIntegrationTests.allRepliesAreReceivedViaLimitedCachingConnectionFactory()` test and ensure that all 27 letters from English alphabet are sent to the server and received in uppercase while size of the `CachingClientConnectionFactory` is only `10` (cherry picked from commit dc02dec)
Fixes: #9430 When `CachingClientConnectionFactory` is used in combination of `Tcp.outboundAdapter()` & `Tcp.inboundAdapter()`, the connection is not released back to the cache because `CachingClientConnectionFactory` does not store created connections into its `connections` property. So, when `TcpReceivingChannelAdapter` calls `this.clientConnectionFactory.closeConnection(connectionId);` it returned immediately because there is nothing to remove from the `this.connections` * Add `protected removeConnection()` in the `AbstractConnectionFactory` and override it in the `CachingClientConnectionFactory` with delegation to the `this.targetConnectionFactory` * Demonstrate the problem in the new `IpIntegrationTests.allRepliesAreReceivedViaLimitedCachingConnectionFactory()` test and ensure that all 27 letters from English alphabet are sent to the server and received in uppercase while size of the `CachingClientConnectionFactory` is only `10` (cherry picked from commit dc02dec)
Hi, Thanks for the prompt reply in stack overflow. Here is the repo if someone wants to reproduce it. I will try testing again if the problem persists. Thanks. |
Hi, @shirshak55 ! |
I tested it with 6.4.0-SNAPSHOT and here is the result. Scenerio 1: Logs:
Scenerio 2: Here each client sends the message to server, but on 11th message time has elapsed only like 1sec, it can't get the pool and spring integration errors out. Client side logs
Server side logs:
So, i believe these behaviors are correct. Thanks, |
I’ll look into your application tomorrow, but first scenario feels like without caching wrapper. The seconds one feels like without my recent fix in action. |
Yeah... Something is still off with my fix. Thank you for quick turn around about testing this stuff! |
Related to: #9430 **Auto-cherry-pick to `6.3.x` & `6.2.x`**
Fixed via: 8242ca6. please, give the latest snapshot one more shot! |
Hi, Whats the latest SNAPSHOT version. Same 6.4.0-SNAPSHOT? |
Yep! That's the one. |
Great. Here is the testing result: Scenerio 1: Server Log
Client (Spring Integration)
Now: TCP Server side Log: (nodejs)
Client side log
Let me know if its correct behavior. Thank you. |
Thank you for testing this so fast! Tell me, please, if you receive all the 20 messages in the second scenario. |
Hi,
In second scenario, after the first 10 req is sent other 10 wont be sent
due to pool not found error.
…On Tue, Sep 3, 2024 at 9:25 AM Artem Bilan ***@***.***> wrote:
@shirshak55 <https://github.com/shirshak55> ,
Thank you for testing this so fast!
Tell me, please, if you receive all the 20 messages in the second scenario.
—
Reply to this email directly, view it on GitHub
<#9430 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB5Y4YPULCWHIQ7YFWLVD53ZUW2DLAVCNFSM6AAAAABNLH65R6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRWGUZDCNRYGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Oh, right! If you put that onto retry, it will kick them off when old replies are received. |
Yes, after getting replies it starts to send again. Is there anyway to send those error (pool not found) message to lets say error channel? Afaik inbound adapter provides error channel, outbound doesn't. I can do it at gateway level, but gateway is too far from outbound adapter due to too many service activators etc.. Thanks |
Well, I guess in Java you would do |
Yea, i have been doing try catch. I believe this bug is solved. Thanks you for passing me advice link. I will close the stack overflow also. Thanks. |
See more info on StackOverlfow: https://stackoverflow.com/questions/78916759/tcp-caching-connection-not-working-as-expected
The text was updated successfully, but these errors were encountered: