Then, connect to the remote server in parallel and inspect what the wrapper script is doing (for instance, using strace or a debugger), it should be waiting for something.
Comment on Re^3: Perl (Net::SSH::Perl) script sometimes hangs while running remote command but shell script works