in reply to Re: Script hangs when executing command over ssh
in thread Script hangs when executing command over ssh

redirecting STDERR to STDOUT is not an option

Then it is might be doubly imperative that you stop using 1>&2, because 1>&2causes STDERR STDOUTto be redirected to STDOUT STDERR.