[ 
https://issues.apache.org/jira/browse/SSHD-921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16865008#comment-16865008
 ] 

Goldstein Lyor edited comment on SSHD-921 at 6/16/19 1:31 PM:
--------------------------------------------------------------

I see the change - however I am not sure why {{authTimeout}} is the correct one 
to wait ? What if there is no traffic on the channel ? Perhaps the session 
IDLE_TIMEOUT would be better suited here - or maybe an entirely *new* 
configuration value (in which case - what should be its default value...?)
 
See SSHD-923 that I created for this purpose


was (Author: lgoldstein):
I see the change - however I am not sure why {{authTimeout}} is the correct one 
to wait ? What if there is no traffic on the channel ? Perhaps the session 
IDLE_TIMEOUT would be better suited here - or maybe an entirely *new* 
configuration value (in which case - what should be its default value...?)

> OutOfMemory Error in extreme situations
> ---------------------------------------
>
>                 Key: SSHD-921
>                 URL: https://issues.apache.org/jira/browse/SSHD-921
>             Project: MINA SSHD
>          Issue Type: Bug
>    Affects Versions: 1.7.0, 2.0.0
>            Reporter: Zhenliang Su
>            Assignee: Goldstein Lyor
>            Priority: Major
>         Attachments: Main.java, jstack.txt
>
>
> The demo code run in my local machine.
>  When I 'ssh [email protected] -p 2233', my demo will use the agent forwarding 
> feature to login 10.10.16.201.
>  In most cases, it's ok. But in few cases, for example, client disconnect 
> suddenly, it will lead to OutOfMemory Error.
>  To simulate this scenario of OutOfMemory Error, I did some trick to the sshd 
> code:
>  1. In org.apache.sshd.common.future.DefaultSshFuture#setValue:
> {code:java}
> public void setValue(Object newValue) {
>       // to simulate race condition
>       try {
>               Thread.sleep(10);
>       } catch (Exception e) {
>               // ignore
>       }
>         synchronized (lock) {
>             // Allow only once.
>             if (result != null) {
>                 return;
>             }
>             result = (newValue != null) ? newValue : GenericUtils.NULL;
>             lock.notifyAll();
>         }
>         notifyListeners();
>     }
> {code}
> 2. In org.apache.sshd.agent.local.AgentForwardedChannel#doWriteData:
> {code:java}
>  protected void doWriteData(byte[] data, int off, long len) throws 
> IOException {
>         ValidateUtils.checkTrue(len <= Integer.MAX_VALUE, "Data length 
> exceeds int boundaries: %d", len);
>         Buffer message = null;
>         synchronized (receiveBuffer) {
>             receiveBuffer.putBuffer(new ByteArrayBuffer(data, off, (int) 
> len));
>             // to simulate client disconnect suddenly
>             if (false && receiveBuffer.available() >= 4) {
>                 off = receiveBuffer.rpos();
>                 len = receiveBuffer.getInt();
>                 receiveBuffer.rpos(off);
>                 if (receiveBuffer.available() >= (4 + len)) {
>                     message = new ByteArrayBuffer(receiveBuffer.getBytes());
>                     receiveBuffer.compact();
>                 }
>             }
>         }
>         if (message != null) {
>             synchronized (messages) {
>                 messages.offer(message);
>                 messages.notifyAll();
>             }
>         }
>     }
> {code}
> After two munites, my console displayed 
> '[sshd-SshClient[720b3c53]-timer-thread-1] INFO 
> org.apache.sshd.client.session.ClientSessionImpl - 
> Disconnecting(ClientSessionImpl[root@/10.10.16.201:8022]): 
> SSH2_DISCONNECT_PROTOCOL_ERROR - Session has timed out waiting for 
> authentication after 120000 ms.' every second, and finally lead to 
> OutOfMemory Error.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to