From c3a61a040edbd1126be18a0398053de2a28d0d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Caama=C3=B1o=20Ruiz?= Date: Thu, 12 Dec 2019 18:16:17 +0100 Subject: [PATCH] ssh: Fix deadlock on agent forwarding error If there is an error when opening the session for agent forwarding in the process ssh connention, there is a deadlock when recursively calling Connect on an internal reattempt. Avoid that, and let the connection be reattempted externally. --- communicator/ssh/communicator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/communicator/ssh/communicator.go b/communicator/ssh/communicator.go index 349d67937..f39d70898 100644 --- a/communicator/ssh/communicator.go +++ b/communicator/ssh/communicator.go @@ -206,7 +206,7 @@ func (c *Communicator) Connect(o terraform.UIOutput) (err error) { } log.Printf("[DEBUG] Setting up a session to request agent forwarding") - session, err := c.newSession() + session, err := c.client.NewSession() if err != nil { return err }