Patch to fix ssh library

Kris Rasmussen <>
Wed Nov 18 20:00:33 CET 2009

I was noticing that when receiving large amounts of data the erlang SSH
library would often freeze and no longer receive any data from the server I
was connecting to. After a bit of work, I tracked this down to an "infinite"
loop in ssh_connection_handler.erl. The problem occurs when the first block
has not yet been decoded and a call to next_packet is made. This would
trigger the process to send itself a socket-receive message but it's
possible that there isn't additional data ready on the socket. I fixed this
by adding a call to make the socket active again as is the case in the
subsequent next_packet function definition when the decoded_data_buffer is
not empty.

>From my testing so far, this resolves the issue and I have not yet seen any
other side effects. Please let me know what you think.

I've attached my patch for R13B02, but you can also get it here:


Kris Rasmussen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-lib-ssh-src-ssh_connection_handler.erl.diff
Type: application/octet-stream
Size: 446 bytes
Desc: not available
URL: <>

More information about the erlang-patches mailing list