Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -362,7 +362,19 @@ func (clnt *client) Signal(containerID string, sig int) error {
|
| 362 | 362 |
} |
| 363 | 363 |
|
| 364 | 364 |
// Shutdown the compute system |
| 365 |
- if err := hcsshim.ShutdownComputeSystem(containerID, hcsshim.TimeoutInfinite, context); err != nil {
|
|
| 365 |
+ const shutdownTimeout = 5 * 60 * 1000 // 5 minutes |
|
| 366 |
+ if err := hcsshim.ShutdownComputeSystem(containerID, shutdownTimeout, context); err != nil {
|
|
| 367 |
+ if herr, ok := err.(*hcsshim.HcsError); !ok || |
|
| 368 |
+ (herr.Err != hcsshim.ERROR_SHUTDOWN_IN_PROGRESS && |
|
| 369 |
+ herr.Err != ErrorBadPathname && |
|
| 370 |
+ herr.Err != syscall.ERROR_PATH_NOT_FOUND) {
|
|
| 371 |
+ logrus.Debugf("signal - error from ShutdownComputeSystem %v on %s. Calling TerminateComputeSystem", err, containerID)
|
|
| 372 |
+ if err := hcsshim.TerminateComputeSystem(containerID, shutdownTimeout, "signal"); err != nil {
|
|
| 373 |
+ logrus.Debugf("signal - ignoring error from TerminateComputeSystem on %s %v", containerID, err)
|
|
| 374 |
+ } else {
|
|
| 375 |
+ logrus.Debugf("Successful TerminateComputeSystem after failed ShutdownComputeSystem on %s during signal %v", containerID, sig)
|
|
| 376 |
+ } |
|
| 377 |
+ } |
|
| 366 | 378 |
logrus.Errorf("Failed to shutdown %s - %q", containerID, err)
|
| 367 | 379 |
} |
| 368 | 380 |
} |
| ... | ... |
@@ -185,7 +185,12 @@ func (ctr *container) waitExit(pid uint32, processFriendlyName string, isFirstPr |
| 185 | 185 |
(herr.Err != hcsshim.ERROR_SHUTDOWN_IN_PROGRESS && |
| 186 | 186 |
herr.Err != ErrorBadPathname && |
| 187 | 187 |
herr.Err != syscall.ERROR_PATH_NOT_FOUND) {
|
| 188 |
- logrus.Warnf("Ignoring error from ShutdownComputeSystem %s", err)
|
|
| 188 |
+ logrus.Debugf("waitExit - error from ShutdownComputeSystem on %s %v. Calling TerminateComputeSystem", ctr.containerCommon, err)
|
|
| 189 |
+ if err := hcsshim.TerminateComputeSystem(ctr.containerID, shutdownTimeout, "waitExit"); err != nil {
|
|
| 190 |
+ logrus.Debugf("waitExit - ignoring error from TerminateComputeSystem %s %v", ctr.containerID, err)
|
|
| 191 |
+ } else {
|
|
| 192 |
+ logrus.Debugf("Successful TerminateComputeSystem after failed ShutdownComputeSystem on %s in waitExit", ctr.containerID)
|
|
| 193 |
+ } |
|
| 189 | 194 |
} |
| 190 | 195 |
} else {
|
| 191 | 196 |
logrus.Debugf("Completed shutting down container %s", ctr.containerID)
|