Question

I am trying to download a pdf file and getting below exception when file size is greater than 32,609 bytes. size smaller than this downloads fine:

java.io.IOException: More data recieved than is allowed by the channel data window [scp] at com.sshtools.j2ssh.connection.Channel.processChannelData(Channel.java:149) at com.sshtools.j2ssh.connection.ConnectionProtocol.onMsgChannelData(ConnectionProtocol.java:806) at com.sshtools.j2ssh.connection.ConnectionProtocol.onMessageReceived(ConnectionProtocol.java:609) at com.sshtools.j2ssh.transport.AsyncService.run(AsyncService.java:115)

Also this is happening in only one environment. Same code working fine on different jboss(appserver), apache(webserver) and linux(OS) environment. Is there any server level setting that can increase the window channel size and fix this error?

Thanks and Regards

Was it helpful?

Solution

Well fixed the issue by changing the API itself. In channel.java class added additional if condition and increased the size if its less than required. Hope this helps other but I would still like to know if there is any configuration at OS or server level to fix this. Code below is the modified version.

if (msg.getChannelDataLength() > localWindow.getWindowSpace()) {

                // Increase the window space as needed and see what happens  
                long lDifference = msg.getChannelDataLength() - localWindow.getWindowSpace();  
                localWindow.increaseWindowSpace(lDifference+1);  

                if ( msg.getChannelDataLength() > localWindow.getWindowSpace() ) {  
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top