-
Notifications
You must be signed in to change notification settings - Fork 1.1k
The shared SFTP session is closed prematurely #9909
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
Comments
Fixes: #9909 Issue link: #9909 The `SftpSession.close()` closes `sftpClient` and its `clientSession` unconditionally. At the same time the `DefaultSftpSessionFactory.isSharedSession` is expected to expose only a single shared client. When this `DefaultSftpSessionFactory` is used concurrently, there is a chance that one thread would close that shared client and another won't be able to interact due to `clientSession` is closed. * Fix `SftpSession` accepting an `isSharedClient` flag and doing nothing in the `close()` if client is shared. * Propagate `isSharedSession` state down to the `SftpSession` from the `DefaultSftpSessionFactory` * Closed shared client and its `clientSession` in the `DefaultSftpSessionFactory.destroy()` (cherry picked from commit 2df9611)
Fixes: #9909 Issue link: #9909 The `SftpSession.close()` closes `sftpClient` and its `clientSession` unconditionally. At the same time the `DefaultSftpSessionFactory.isSharedSession` is expected to expose only a single shared client. When this `DefaultSftpSessionFactory` is used concurrently, there is a chance that one thread would close that shared client and another won't be able to interact due to `clientSession` is closed. * Fix `SftpSession` accepting an `isSharedClient` flag and doing nothing in the `close()` if client is shared. * Propagate `isSharedSession` state down to the `SftpSession` from the `DefaultSftpSessionFactory` * Closed shared client and its `clientSession` in the `DefaultSftpSessionFactory.destroy()` (cherry picked from commit 2df9611) # Conflicts: # spring-integration-sftp/src/test/java/org/springframework/integration/sftp/session/SftpSessionFactoryTests.java
@artembilan We are facing issues with this in single threaded environment too, with combination of shared SFTP session set to true and using CachingSessionFactory. Attaching the logs for your review.
|
The issue has been fixed and releases yesterday. Please consider to upgrade . You must not use shared and caching together. Shared is already cached. However I agree that with the problem we had so far it still may fail. Because, well , it is shared. I’m not why you say “single threaded” since Spring Batch is not like that. |
@artembilan , sorry, I meant our batch job runs steps sequentially in a single thread where we use CachingSessionFactory. |
Doesn’t look like . Your stack trace contains a |
@artembilan Sorry my bad, let me look into this more. Thanks. |
With the
new DefaultSftpSessionFactory(true)
, theSftpSession.close()
leads to the problem in concurrent environment:More info in: apache/mina-sshd#527
Right now the workaround is to use
CachingSessionFactory
which does not initiate a physical close of the client session.This is a side effect of the fix from: #9272.
The text was updated successfully, but these errors were encountered: