Skip to content
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

GH-3827: Fix RemoteFile GET STREAM session leak #3853

Merged
merged 1 commit into from
Jul 18, 2022

Conversation

artembilan
Copy link
Member

Fixes #3827

The AbstractRemoteFileOutboundGateway.doGet() for a STREAM option
does not close the session in case of error.
This may lead to some leaks or exhausted caches

  • Close session in the catch() of the AbstractRemoteFileOutboundGateway.doGet()
  • Adjust the SftpServerOutboundTests to configure a CachingSessionFactory
    for the testStream() to verify there is no leaks attempting to
    GET STREAM non-existing remote file twice

Cherry-pick to 5.5.x

Fixes spring-projects#3827

The `AbstractRemoteFileOutboundGateway.doGet()` for a `STREAM` option
does not close the `session` in case of error.
This may lead to some leaks or exhausted caches

* Close `session` in the `catch()` of the `AbstractRemoteFileOutboundGateway.doGet()`
* Adjust the `SftpServerOutboundTests` to configure a `CachingSessionFactory`
for the `testStream()` to verify there is no leaks attempting to
`GET STREAM` non-existing remote file twice

**Cherry-pick to `5.5.x`**
@garyrussell garyrussell merged commit 8f44870 into spring-projects:main Jul 18, 2022
@garyrussell
Copy link
Contributor

...and cherry-picked as 19b4668

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.

Close Sftp Session before exception is thrown ?
2 participants