-
Notifications
You must be signed in to change notification settings - Fork 1.1k
spring-integration-sftp: org.apache.sshd.common.io.WritePendingException: A write operation is already pending; #8708
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
So, it looks like all the
where that I believe that:
should be locked if we cannot call it concurrently. But that's an Apache MINA side. Since we don't have a choice right now, I'm going to lock all the operations in the |
Fixes spring-projects#8708 According to the `org.apache.sshd.common.channel.ChannelAsyncOutputStream.writeBuffer()` JavaDocs cannot be used concurrently. * Introduce internal `DefaultSftpSessionFactory.ConcurrentSftpClient` extension of the `DefaultSftpClient` to set a `Lock` around `super.send(cmd, buffer);` * Remove lock from the `SftpSession` since it now is managed by the mentioned `ConcurrentSftpClient` **Cherry-pick to `6.1.x` & `6.0.x`**
Fixes #8708 According to the `org.apache.sshd.common.channel.ChannelAsyncOutputStream.writeBuffer()` JavaDocs cannot be used concurrently. * Introduce internal `DefaultSftpSessionFactory.ConcurrentSftpClient` extension of the `DefaultSftpClient` to set a `Lock` around `super.send(cmd, buffer);` * Remove lock from the `SftpSession` since it now is managed by the mentioned `ConcurrentSftpClient` **Cherry-pick to `6.1.x` & `6.0.x`**
Fixes #8708 According to the `org.apache.sshd.common.channel.ChannelAsyncOutputStream.writeBuffer()` JavaDocs cannot be used concurrently. * Introduce internal `DefaultSftpSessionFactory.ConcurrentSftpClient` extension of the `DefaultSftpClient` to set a `Lock` around `super.send(cmd, buffer);` * Remove lock from the `SftpSession` since it now is managed by the mentioned `ConcurrentSftpClient` **Cherry-pick to `6.1.x` & `6.0.x`** # Conflicts: # spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java
Fixes #8708 According to the `org.apache.sshd.common.channel.ChannelAsyncOutputStream.writeBuffer()` JavaDocs cannot be used concurrently. * Introduce internal `DefaultSftpSessionFactory.ConcurrentSftpClient` extension of the `DefaultSftpClient` to set a `Lock` around `super.send(cmd, buffer);` * Remove lock from the `SftpSession` since it now is managed by the mentioned `ConcurrentSftpClient` **Cherry-pick to `6.1.x` & `6.0.x`** # Conflicts: # spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java
Hi @artembilan, I know this one is old, but could you explain why you always use a lock even if you do not use a shared session ? Is there any added value in this case ? |
Hi, @baiglin ! Well, look at the situation like this: Or do you want to have some slight optimization where we check for the |
Hi again @artembilan , Thanks a lot for the quick reply, and no your explanation is enough for me, indeed you cannot expect calling code to use it in a sequential way even if creating a new session each time. So that answers my question :). I have a similar exception even though I use a fresh client each time, so was wondering the rational behind you fix. But I will open a ticket directly to apache MINA. By the way if I may ask, I was wondering why; when using a shared session; you now use one session and one client only (which to me is equivalent to a channel) compare to the way it was done with JSch where you were keeping a single session but creating different channels... I think this is due to the async configuration of Apache MINA and fact that it handles path differently but till I wonder? Thanks again. |
You maybe mean this:
So, even if we use In the end, that's why wrapping into a |
Correct, but from what I check it attempts a reconnect on the channel if not opened, anyway, I wont bother you more if you did not touch the JSch ones ;), thanks for your precious feedbacks. |
@baiglin , |
Discussed in #8707
When we upgraded out application to Spring boot 3 we started getting issues like this:
We found out that issues is when you call
RemoteFileTemplate.list()
method concurrently. SinceChannelAsyncOutputStream.writeBuffer()
cannot be caller concurrently.Before upgrading to SB3 we had no issues like this.
So my question is, is this a bug in new implementation in SB3 using apache mina SSHD or is this expected behaviour and we should not call this method from different threads?
The text was updated successfully, but these errors were encountered: