mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fixing retry hack for TP4 to return errors in all failure cases.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
This commit is contained in:
parent
ba5a282a83
commit
0b82202fbb
1 changed files with 21 additions and 24 deletions
|
@ -238,33 +238,30 @@ func (d *Driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, hooks execd
|
||||||
// TODO Windows TP5 timeframe. Remove when TP4 is no longer supported.
|
// TODO Windows TP5 timeframe. Remove when TP4 is no longer supported.
|
||||||
// The following a workaround for Windows TP4 which has a networking
|
// The following a workaround for Windows TP4 which has a networking
|
||||||
// bug which fairly frequently returns an error. Back off and retry.
|
// bug which fairly frequently returns an error. Back off and retry.
|
||||||
maxAttempts := 1
|
maxAttempts := 5
|
||||||
if TP4RetryHack {
|
for i := 0; i < maxAttempts; i++ {
|
||||||
maxAttempts = 5
|
|
||||||
}
|
|
||||||
i := 0
|
|
||||||
for i < maxAttempts {
|
|
||||||
i++
|
|
||||||
err = hcsshim.CreateComputeSystem(c.ID, configuration)
|
err = hcsshim.CreateComputeSystem(c.ID, configuration)
|
||||||
if err != nil {
|
if err == nil {
|
||||||
if TP4RetryHack {
|
|
||||||
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
|
|
||||||
herr.Err != ErrorNoNetwork && // The network is not present or not started
|
|
||||||
herr.Err != ErrorBadPathname && // The specified path is invalid
|
|
||||||
herr.Err != CoEClassstring && // Invalid class string
|
|
||||||
herr.Err != ErrorInvalidObject { // The object identifier does not represent a valid object
|
|
||||||
logrus.Debugln("Failed to create temporary container ", err)
|
|
||||||
return execdriver.ExitStatus{ExitCode: -1}, err
|
|
||||||
}
|
|
||||||
logrus.Warnf("Invoking Windows TP4 retry hack (%d of %d)", i, maxAttempts-1)
|
|
||||||
time.Sleep(50 * time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break
|
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
|
||||||
|
herr.Err != ErrorNoNetwork && // The network is not present or not started
|
||||||
|
herr.Err != ErrorBadPathname && // The specified path is invalid
|
||||||
|
herr.Err != CoEClassstring && // Invalid class string
|
||||||
|
herr.Err != ErrorInvalidObject { // The object identifier does not represent a valid object
|
||||||
|
logrus.Debugln("Failed to create temporary container ", err)
|
||||||
|
return execdriver.ExitStatus{ExitCode: -1}, err
|
||||||
|
}
|
||||||
|
logrus.Warnf("Invoking Windows TP4 retry hack (%d of %d)", i, maxAttempts-1)
|
||||||
|
time.Sleep(50 * time.Millisecond)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the container
|
// Start the container
|
||||||
|
|
Loading…
Add table
Reference in a new issue