You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Stefan Müller <st...@menten.com> on 2022/10/07 15:31:40 UTC

Help understand SSHD server exception "bad length"

The SSHD server shows following error while receiving an file:
[NioProcessor-18] [WARN ] exceptionCaught(ServerSessionImpl[<private/address:port>])[state=Opened]
IllegalStateException: Bad length (32796) for cmd=SSH_MSG_CHANNEL_DATA - max. allowed=32768

My first thought is that it is only a warning and I can ignore it. But the received file is empty. After looking at the source code i think it is an error and the client sends too much data.

Can somebody explain what is going on?

Stefan Müller
Softwareentwickler

menten GmbH
An der Gohrsmühle 25 | 51465 Bergisch Gladbach | Deutschland
stefan.mueller@menten.com<ma...@menten.com> | +49 2202 2399 0<tel:0049220223990> | www.menten.com<https://www.menten.com/de>

Geschäftsführer: Ralph Menten | Handelsregister Köln, HRB 47762

[cid:WEAREHIRING_84b94425-089e-4246-8028-eaf6ac7a430f.png]<https://www.menten.com/de/stellenangebote>

Re: Help understand SSHD server exception "bad length"

Posted by Thomas Wolf <tw...@apache.org>.
On 07.10.22 17:31 , Stefan Müller wrote:
> The SSHD server shows following error while receiving an file:
> 
> [NioProcessor-18] [WARN ] 
> exceptionCaught(ServerSessionImpl[<private/address:port>])[state=Opened]
> 
> IllegalStateException: Bad length (32796) for cmd=SSH_MSG_CHANNEL_DATA - 
> max. allowed=32768
> 
> My first thought is that it is only a warning and I can ignore it. But 
> the received file is empty. After looking at the source code i think it 
> is an error and the client sends too much data.
> 
> Can somebody explain what is going on?

I know this is nearly a year old, but maybe you're still interested. 
We've finally figured it out.

It appears to be a bug in a particular SFTP client. See

* https://github.com/apache/mina-sshd/issues/403
* 
https://community.progress.com/s/question/0D54Q0000ASQm9FSQT/bad-length-32796-for-cmdsshmsgchanneldata-max-allowed32768

Cheers,

   Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@mina.apache.org
For additional commands, e-mail: users-help@mina.apache.org


Re: Help understand SSHD server exception "bad length"

Posted by Stefan Magnus Landrø <st...@gmail.com>.
Check here:

https://github.com/apache/mina-sshd/blob/master/sshd-common/src/main/java/org/apache/sshd/common/SshConstants.java

Sendt fra min iPhone

> 7. okt. 2022 kl. 18:15 skrev Thomas Wolf <t....@gmail.com>:
> 
> On 07.10.22 17:31 , Stefan Müller wrote:
>> The SSHD server shows following error while receiving an file:
>> [NioProcessor-18] [WARN ] exceptionCaught(ServerSessionImpl[<private/address:port>])[state=Opened]
>> IllegalStateException: Bad length (32796) for cmd=SSH_MSG_CHANNEL_DATA - max. allowed=32768
>> My first thought is that it is only a warning and I can ignore it. But the received file is empty. After looking at the source code i think it is an error and the client sends too much data.
>> Can somebody explain what is going on?
> 
> Not fully from this description, but I agree that the message indicates
> that a client sent a packet larger than the maximum packet size the
> server allows on the channel.
> 
> What maximum packet size does the client have for this channel (should
> be in the SSH_MSG_CHANNEL_OPEN message; if you switch on debug logging,
> you should be able to see it).
> 
> What client is this? Also Apache MINA sshd, or something else? If not
> Apache MINA sshd, there's nothing we can do, and the problem needs to be
> fixed in the buggy client.
> 
> And what operation is performed exactly? You mention "file upload"...
> via SFTP or SCP?
> 
> Cheers,
> 
> Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@mina.apache.org
> For additional commands, e-mail: users-help@mina.apache.org
> 

Re: Help understand SSHD server exception "bad length"

Posted by Thomas Wolf <t....@gmail.com>.
On 07.10.22 17:31 , Stefan Müller wrote:
> The SSHD server shows following error while receiving an file:
> 
> [NioProcessor-18] [WARN ] 
> exceptionCaught(ServerSessionImpl[<private/address:port>])[state=Opened]
> 
> IllegalStateException: Bad length (32796) for cmd=SSH_MSG_CHANNEL_DATA - 
> max. allowed=32768
> 
> My first thought is that it is only a warning and I can ignore it. But 
> the received file is empty. After looking at the source code i think it 
> is an error and the client sends too much data.
> 
> Can somebody explain what is going on?

Not fully from this description, but I agree that the message indicates
that a client sent a packet larger than the maximum packet size the
server allows on the channel.

What maximum packet size does the client have for this channel (should
be in the SSH_MSG_CHANNEL_OPEN message; if you switch on debug logging,
you should be able to see it).

What client is this? Also Apache MINA sshd, or something else? If not
Apache MINA sshd, there's nothing we can do, and the problem needs to be
fixed in the buggy client.

And what operation is performed exactly? You mention "file upload"...
via SFTP or SCP?

Cheers,

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@mina.apache.org
For additional commands, e-mail: users-help@mina.apache.org