Skip to content

Conversation

garyrussell
Copy link
Contributor

Resolves #3509

When a connection was intercepted, the TcpSender.add... was called with the
interceptor, but the removeDead... was called with the actual connection,
causing a memory leak.

Always call the TcpSender with the outer-most interceptor.

Cherry-pick to master after reverting previous fix

Resolves spring-projects#3509

When a connection was intercepted, the `TcpSender.add...` was called with the
interceptor, but the `removeDead...` was called with the actual connection,
causing a memory leak.

Always call the `TcpSender` with the outer-most interceptor.
}
});
TcpConnectionInterceptorFactoryChain fc = new TcpConnectionInterceptorFactoryChain();
fc.setInterceptor(newInterceptorFactory(scf.getApplicationEventPublisher()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work now if we override a getConnectionId() in the HelloWorldInterceptor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because the same object (the outermost interceptor) is always used for addNewConnection an removeDeadConnection.

@artembilan artembilan merged commit 81c3b7d into spring-projects:5.4.x Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants