I was able to debug issue. It happens when 'timeout 120 ssh' is run without --foreground option for timeout and remote server is asking for password. timeout without --foreground, when run from the script will block all input from stdin, which cause ssh to hangs in the loop.
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1646813 Title: ssh (client) stucks in an endless loop with 100% CPU To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/1646813/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs