Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrd: fix task unexpected exit #3002

Merged
merged 1 commit into from
Nov 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ctrd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,14 @@ func (w *watch) isContainerdDead() bool {
// isChannelClosed means containerd break unexpected, all exit channel
// ctrd watched will exit.
func isChannelClosed(s containerd.ExitStatus) bool {
return s.ExitTime().IsZero() && strings.Contains(s.Error().Error(), "transport is closing")
if s.Error() == nil {
return false
}

rpcError := strings.Contains(s.Error().Error(), "transport is closing") ||
strings.Contains(s.Error().Error(), "rpc error")

return s.ExitTime().IsZero() && rpcError
}

func (w *watch) add(ctx context.Context, pack *containerPack) {
Expand Down
2 changes: 1 addition & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (d *Daemon) Run() error {

// after initialize network manager, try to recover all
// running containers
if err := containerMgr.Restore(ctx); err != nil {
if err := containerMgr.Restore(context.Background()); err != nil {
return err
}

Expand Down