Skip to content

Commit f3f1f03

Browse files
committed
Fix: Exec Process deadlock
WaitForExit should have been called after all other methods are called on the process
1 parent 1ace761 commit f3f1f03

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/KubernetesClient/KubernetesClientConfiguration.ConfigFile.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,13 @@ public static ExecCredentialResponse ExecuteExternalCommand(ExternalExecution co
537537

538538
try
539539
{
540-
if (!process.WaitForExit((int)(ExecTimeout.TotalMilliseconds)))
540+
var responseObject = KubernetesJson.Deserialize<ExecCredentialResponse>(process.StandardOutput.ReadToEnd());
541+
542+
if (!process.WaitForExit((int)ExecTimeout.TotalMilliseconds))
541543
{
542544
throw new KubeConfigException("external exec failed due to timeout");
543545
}
544546

545-
var responseObject = KubernetesJson.Deserialize<ExecCredentialResponse>(process.StandardOutput.ReadToEnd());
546547
if (responseObject == null || responseObject.ApiVersion != config.ApiVersion)
547548
{
548549
throw new KubeConfigException(

0 commit comments

Comments
 (0)