apache / mina-sshd

Apache MINA sshd is a comprehensive Java library for client- and server-side SSH.
https://mina.apache.org/sshd-project/
Apache License 2.0
912 stars 361 forks source link

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

Open alinlky opened 2 days ago

alinlky commented 2 days ago

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

alinlky commented 1 day ago

@tomaswolf Can you help handle this issue !!

tomaswolf commented 1 day ago

No, I cannot. First, I don't have the time, and second, it's not possible with just that stack trace.

Note that the channel pool used in an SftpFileSystem was changed in 2.11.0. See the relese notes and the technical docs.