tomaswolf commented on issue #319:
URL: https://github.com/apache/mina-sshd/issues/319#issuecomment-1421316918

   Ian: I don't know.
   
   IIRC, openssh opens channels with an initial window size of zero, and only 
later, when the channel is set up, sends an initial window adjustment. That way 
it can be sure it doesn't get data while it is still setting up the channel. On 
receiving the SSH_MSG_CHANNEL_OPEN, the Apache MINA sshd server creates and 
registers its channel object, and then sends back a 
SSH_MSG_CHANNEL_OPEN_CONFIRMATION. By that time, the channel ID is known server 
side, and is registered in the session server side, and the openssh client 
should definitely not send its window adjustment before it gets that open 
confirmation.
   
   Packet loss seems an unlikely cause. If the SSH_MSG_CHANNEL_OPEN were lost, 
the server wouldn't do anything and never send back an open confirmation, so 
openssh should never send a window adjustment. Likewise if the open 
confirmation was lost.
   
   Could it be possible that there is a race between the server not receiving 
anything for some time, hitting some timeout and closing the session on that 
timeout, but just then getting the window adjustment after already having 
closed the previously opened channel? Perhaps Gerrit could also log 
`channelClosed()` events in its 
`ChannelIdTrackingUnknownChannelReferenceHandler`? I do notice that 
`LAST_CHANNEL_ID_KEY` is public -- are we 100% sure that no other code removes 
this key? When a session is closed, the attributes are cleared; so that might 
be indeed an indication that the session is already closed when the window 
adjustment is about to be handled.
   
   Debug logs might tell more. (And confirm or debunk that theory.)


-- 
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]

Reply via email to