I've found the bug, and have fixed it as described below. I don't
think this is the best way to fix it, but it did prove my theory
on how the bug was occuring.
The problem occurs due to the interaction between drain_outgoing
(in Channel.pm) and client_loop in (SSH2.pm).
If your $stdout is bigger than remote_maxpacket, drain_outgoing
tries to repeatedly call client_loop until the length is reduced
to zero. The problem is that client_loop will not return back
to drain_outgoing, once it is called from inside the while loop
the second time.
MY FIX:
I reasoned that if I could force the client_loop to execute
one-and-only-one-time, for each time it was called from the
drain_outgoing while loop, there would be no problem. To test
this, I did the following:
1.) drain_outgoing: added the following line before the
while loop
(9)
]
