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

Avoid sending a signal to the container during checkpointing #11054

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dawei-sdw
Copy link

When checkpointing, the container.SignalContainer will be blocked until the end of the checkpointing process, during which it cannot acquire the kernel.extMu mutex. As a result, some runsc commands, such as the runsc list, will have to wait. The waiting time may vary with the duration of the checkpoint. This patch adds a flag to prevent sending signals to the container during checkpointing.

When checkpointing, the container.SignalContainer will be blocked until
the end of the checkpointing process, during which it cannot acquire the
kernel.extMu mutex. As a result, some runsc commands, such as the runsc
list, will have to wait. The waiting time may vary with the duration of
the checkpoint. This patch adds a flag to prevent sending signals to the
container during checkpointing.

Signed-off-by: Dawei Shen <[email protected]>
@@ -452,6 +456,9 @@ func (cm *containerManager) ExecuteAsync(args *control.ExecArgs, pid *int32) err
// Checkpoint pauses a sandbox and saves its state.
func (cm *containerManager) Checkpoint(o *control.SaveOpts, _ *struct{}) error {
log.Debugf("containerManager.Checkpoint")
cm.inCheckpointing.CompareAndSwap(0, -1)
defer cm.inCheckpointing.CompareAndSwap(-1, 0)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right. Why do we use CompareAndSwap here? Can more than one checkpoint operation run concurrently? If the answer is yest, so we probably need to use cm.inCheckpointing.Add(1); defer cm.inCheckpointing.Add(-1).

@@ -788,6 +795,9 @@ type SignalArgs struct {
// process group.
func (cm *containerManager) Signal(args *SignalArgs, _ *struct{}) error {
log.Debugf("containerManager.Signal: cid: %s, PID: %d, signal: %d, mode: %v", args.CID, args.PID, args.Signo, args.Mode)
if cm.inCheckpointing.Load() != 0 {
return nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right either. We can't return success if the signal hasn't been sent....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants