Browse Source

Avoid mutex deadlock on panics

Rod Hynes 5 months ago
parent
commit
e3370067ee
1 changed files with 8 additions and 0 deletions
  1. 8 0
      psiphon/server/tunnelServer.go

+ 8 - 0
psiphon/server/tunnelServer.go

@@ -2529,6 +2529,14 @@ func (sshClient *sshClient) run(
 			})
 
 		defer func() {
+
+			// When panicking, propagate the panic instead of trying to
+			// acquire the sshClient lock. Intentional panics may arise from
+			// the protobuf code path in logTunnel.
+			if r := recover(); r != nil {
+				panic(r)
+			}
+
 			setReplayAfterFunc.Stop()
 			completed, _ := sshClient.getHandshaked()
 			if !completed {