Merge pull request #20710 from Microsoft/sjw/tp4retry_fix

Fixing retry hack for TP4 to return errors in all failure cases.
This commit is contained in:
Brian Goff 2016-02-29 19:08:24 -05:00
commit 6a96006959
1 changed files with 21 additions and 24 deletions

View File

@ -238,16 +238,17 @@ func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, hooks execd
// TODO Windows TP5 timeframe. Remove when TP4 is no longer supported.
// The following a workaround for Windows TP4 which has a networking
// bug which fairly frequently returns an error. Back off and retry.
maxAttempts := 1
if TP4RetryHack {
maxAttempts = 5
}
i := 0
for i < maxAttempts {
i++
maxAttempts := 5
for i := 0; i < maxAttempts; i++ {
err = hcsshim.CreateComputeSystem(c.ID, configuration)
if err != nil {
if TP4RetryHack {
if err == nil {
break
}
if !TP4RetryHack {
return execdriver.ExitStatus{ExitCode: -1}, err
}
if herr, ok := err.(*hcsshim.HcsError); ok {
if herr.Err != syscall.ERROR_NOT_FOUND && // Element not found
herr.Err != syscall.ERROR_FILE_NOT_FOUND && // The system cannot find the file specified
@ -262,10 +263,6 @@ func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, hooks execd
time.Sleep(50 * time.Millisecond)
}
}
} else {
break
}
}
// Start the container
logrus.Debugln("Starting container ", c.ID)