yaroslavambrozyak opened a new issue, #527:
URL: https://github.com/apache/mina-sshd/issues/527
### Version
2.9.2
### Bug description
Hi, recently after migrating from JSch lib to mina we started facing a
connection reset by peer issue (log below). Our service writes small files up
to 10kb to a SFTP server. The problem occurs only on a high load when we get
around 50 requests within one minute, so out of 50 we get around 3-4 failed. We
don't face this when using JSch lib on the same load and environment.
We use Spring integration sftp package (which uses mina-sshd under the hood)
and haven't configured anything else explicitly, all settings are default.
I could also observe these logs in FileZilla when I tried to connect to the
server during the high load test
```
Error: FATAL ERROR: Remote side sent disconnect message
Error: type 12 (too many connections):
```
As I understand it creates many connections so after some time the server
starts to refuse to accept a new one, but it is not clear enough why we don't
have the same when we use JSch lib.
Do you have any tips/docs that we can use to try different approaches or
configurations to solve this?
### Actual behavior
Connection reset by peer exception on high-load
### Expected behavior
No issues on high-loads
### Relevant log output
```Shell
Caused by: java.io.IOException: Connection reset by peer
at java.base/sun.nio.ch.FileDispatcherImpl.write0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.write(Unknown Source)
at java.base/sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source)
at java.base/sun.nio.ch.IOUtil.write(Unknown Source)
at java.base/sun.nio.ch.IOUtil.write(Unknown Source)
at
java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.implWrite(Unknown Source)
at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.write(Unknown
Source)
at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.write(Unknown
Source)
at
org.apache.sshd.common.io.nio2.Nio2Session.doWriteCycle(Nio2Session.java:534)
at
org.apache.sshd.common.io.nio2.Nio2Session.startWriting(Nio2Session.java:516)
at
org.apache.sshd.common.io.nio2.Nio2Session.writeBuffer(Nio2Session.java:191)
at
org.apache.sshd.common.session.helpers.AbstractSession.doWritePacket(AbstractSession.java:1154)
at
org.apache.sshd.common.session.helpers.KeyExchangeMessageHandler.writePacket(KeyExchangeMessageHandler.java:244)
at
org.apache.sshd.common.session.helpers.AbstractSession.writePacket(AbstractSession.java:1066)
at org.apache.sshd.client.kex.DHGClient.init(DHGClient.java:107)
at
org.apache.sshd.common.session.helpers.AbstractSession.doKexNegotiation(AbstractSession.java:928)
at
org.apache.sshd.common.session.helpers.AbstractSession.handleKexInit(AbstractSession.java:867)
at
org.apache.sshd.common.session.helpers.AbstractSession.doHandleMessage(AbstractSession.java:596)
at
org.apache.sshd.common.session.helpers.AbstractSession.lambda$handleMessage$0(AbstractSession.java:545)
at
org.apache.sshd.common.util.threads.ThreadUtils.runAsInternal(ThreadUtils.java:68)
at
org.apache.sshd.common.session.helpers.AbstractSession.handleMessage(AbstractSession.java:544)
at
org.apache.sshd.common.session.helpers.AbstractSession.decode(AbstractSession.java:1688)
at
org.apache.sshd.common.session.helpers.AbstractSession.messageReceived(AbstractSession.java:505)
at
org.apache.sshd.common.session.helpers.AbstractSessionIoHandler.messageReceived(AbstractSessionIoHandler.java:64)
at
org.apache.sshd.common.io.nio2.Nio2Session.handleReadCycleCompletion(Nio2Session.java:409)
at
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:382)
at
org.apache.sshd.common.io.nio2.Nio2Session$1.onCompleted(Nio2Session.java:377)
at
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.lambda$completed$0(Nio2CompletionHandler.java:38)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at
org.apache.sshd.common.io.nio2.Nio2CompletionHandler.completed(Nio2CompletionHandler.java:37)
at java.base/sun.nio.ch.Invoker.invokeUnchecked(Unknown Source)
at java.base/sun.nio.ch.Invoker$2.run(Unknown Source)
at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(Unknown
Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
... 1 more
```
```
### Other information
Java 17
Spring Boot 3.1.2
Apache mina sshd 2.9.2
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]