-
Notifications
You must be signed in to change notification settings - Fork 948
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
fix: fix cri exec hang #2224
fix: fix cri exec hang #2224
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,13 +122,18 @@ func (c *Client) execContainer(ctx context.Context, process *Process) error { | |
exitTime: status.ExitTime(), | ||
} | ||
|
||
// run hook if not got fail here | ||
if err := <-fail; err == nil { | ||
for _, hook := range c.hooks { | ||
if err := hook(process.ExecID, msg); err != nil { | ||
logrus.Errorf("failed to execute the exec exit hooks: %v", err) | ||
break | ||
} | ||
if err := <-fail; err != nil { | ||
msg.err = err | ||
// exit code should not be zero when exec get failed. | ||
if msg.exitCode == 0 { | ||
msg.exitCode = 126 | ||
} | ||
} | ||
// XXX: if exec process get run, io should be closed in this function, | ||
for _, hook := range c.hooks { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now, no matter run There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, when exec start , no matter what result, let hook do the clean. Before exec start, if got error, let pouch daemon level do the clean. |
||
if err := hook(process.ExecID, msg); err != nil { | ||
logrus.Errorf("failed to execute the exec exit hooks: %v", err) | ||
break | ||
} | ||
} | ||
|
||
|
@@ -141,7 +146,6 @@ func (c *Client) execContainer(ctx context.Context, process *Process) error { | |
// start the exec process | ||
if err := execProcess.Start(ctx); err != nil { | ||
fail <- err | ||
return errors.Wrap(err, "failed to exec process") | ||
} | ||
|
||
return nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether it is possible
exitCode
is not zero whenexec
got error?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It possible, like
exec $id aaaaa
.