apache / apache/mina-sshd

After the upgrade from 2.10.0 to 2.12.0, batch move files,invoke SftpPath.getClient().rename. operation fails after 10 files moved.

Open
#637 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
400
Avg merge
5d 1h
Merged PRs (30d)
1

Description

### Version

2.12.0

### Bug description

After the upgrade from 2.10.0 to 2.12.0, Rename and move file directories on the remote SFTP server, If more than 10 files are operated, the operation fails.
Invoke the SftpPath.getClient() .rename();

### Actual behavior

Failed (SshChannelOpenException) to execute: open failed
at org.apache.sshd.common.future.AbstractSshFuture.lambda$verifyResult$2(AbstractSshFuture.java:146) ~[sshd-common.jar:2.12.0]
at org.apache.sshd.common.future.AbstractSshFuture.formatExceptionMessage(AbstractSshFuture.java:206) ~[sshd-common.jar:2.12.0]
at org.apache.sshd.common.future.AbstractSshFuture.verifyResult(AbstractSshFuture.java:145) ~[sshd-common.jar:2.12.0]
at org.apache.sshd.client.future.DefaultOpenFuture.verify(DefaultOpenFuture.java:39) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.client.future.DefaultOpenFuture.verify(DefaultOpenFuture.java:32) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.future.VerifiableFuture.verify(VerifiableFuture.java:74) ~[sshd-common.jar:2.12.0]
at org.apache.sshd.sftp.client.impl.DefaultSftpClient.(DefaultSftpClient.java:103) ~[sshd-sftp.jar:2.12.0]
at org.apache.sshd.sftp.client.impl.DefaultSftpClientFactory.createDefaultSftpClient(DefaultSftpClientFactory.java:66) ~[sshd-sftp.jar:2.12.0]
at org.apache.sshd.sftp.client.impl.DefaultSftpClientFactory.createSftpClient(DefaultSftpClientFactory.java:50) ~[sshd-sftp.jar:2.12.0]
at org.apache.sshd.sftp.client.fs.SftpFileSystem.getClient(SftpFileSystem.java:249) ~[sshd-sftp.jar:2.12.0]
at com.huawei.payment.sftp.SftpUtils.close(SftpUtils.java) ~[cit_util.jar:?]
at com.huawei.payment.sftp.upload.SftpUploadWorker.close(SftpUploadWorker.java:434) ~[cpt_sftp_file_tool.jar:?]
at com.huawei.payment.sftp.upload.SftpUploadWorker.startWork(SftpUploadWorker.java:111) ~[cpt_sftp_file_tool.jar:?]
at com.huawei.payment.sftp.SftpWorkInstance.dealTaskThroughSftpWork(SftpWorkInstance.java:129) ~[cpt_sftp_file_tool.jar:?]
at com.huawei.payment.sftp.SftpWorkInstance.lambda$dealTaskWithCountDownLatch$1(SftpWorkInstance.java:90) ~[cpt_sftp_file_tool.jar:?]
at com.huawei.payment.thread.TraceableTask.run(TraceableTask.java) ~[cit_util.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_402]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_402]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_402]
Caused by: org.apache.sshd.common.channel.exception.SshChannelOpenException: open failed
at org.apache.sshd.client.channel.AbstractClientChannel.handleOpenFailure(AbstractClientChannel.java:419) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractConnectionService.channelOpenFailure(AbstractConnectionService.java:569) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractConnectionService.process(AbstractConnectionService.java:459) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.CurrentService.process(CurrentService.java:109) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:624) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractSession.lambda$handleMessage$0(AbstractSession.java:545) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:68) ~[sshd-common.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:544) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1688) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:505) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:409) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:382) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:377) ~[sshd-core.jar:2.12.0]
at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$completed$0(Nio2CompletionHandler.java:38) ~[sshd-core.jar:2.12.0]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_402]
at org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37) ~[sshd-core.jar:2.12.0]
at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) ~[?:1.8.0_402]
at sun.nio.ch.Invoker$2.run(Invoker.java:218) ~[?:1.8.0_402]
at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) ~[?:1.8.0_402]

### Expected behavior

How can I fix it?

### Relevant log output

_No response_

### Other information

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure using SftpPath.getClient().rename() with more than 10 remote SFTP operations on version 2.12.0, comparing the 2.10.0 behavior. Start with SftpFileSystem.getClient(), DefaultSftpClientFactory, and the SshChannelOpenException stack trace. Done means the batch completes without the channel-open failure and a regression test covers the reported threshold.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.