It must have been the blocking missing,
I didn't see you have a $chan->blocking(0/1), or if that is the type of blocking you are talking about.
If you google for "Net::SSH2 timeout" you will find it has been tricky to get timeouts to work. The latest module has a few lines where timeouts can be set
connect ( handle | host [, port [, Timeout => secs ]] )
poll ( timeout, arrayref of hashes ) #probably the timeout you want
You might want to look at Net::SSH2 Command Timeout Before Completion
for other modules that handle the timeouts better.