Skip to content

Commit

Permalink
Merge pull request microsoft#142 from darrenstahlmsft/CreateTimeout
Browse files Browse the repository at this point in the history
Cleanup on failed container create due to timeout
  • Loading branch information
darstahl authored Sep 8, 2017
2 parents b144c60 + 12f6b54 commit 4486bc2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,18 @@ func createContainerWithJSON(id string, c *ContainerConfig, additionalJSON strin

if createError == nil || IsPending(createError) {
if err := container.registerCallback(); err != nil {
// Terminate the container if it still exists. We're okay to ignore a failure here.
container.Terminate()
return nil, makeContainerError(container, operation, "", err)
}
}

err = processAsyncHcsResult(createError, resultp, container.callbackNumber, hcsNotificationSystemCreateCompleted, &defaultTimeout)
if err != nil {
if err == ErrTimeout {
// Terminate the container if it still exists. We're okay to ignore a failure here.
container.Terminate()
}
return nil, makeContainerError(container, operation, configuration, err)
}

Expand Down

0 comments on commit 4486bc2

Please # to comment.