Skip to content

Commit 0bdeee7

Browse files
committed
checkpoint: shutdown the criu rpc socket
I don't know why, but now criuClient.Close() doesn't close a unix socket, looks like we have a few other references to it. We can call shutdown() to be sure that it will be closed. Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
1 parent 3b6d1b9 commit 0bdeee7

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

libcontainer/container_linux.go

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,38 +1079,29 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts *
10791079
continue
10801080
case t == criurpc.CriuReqType_RESTORE:
10811081
case t == criurpc.CriuReqType_DUMP:
1082-
break
10831082
case t == criurpc.CriuReqType_PRE_DUMP:
1084-
// In pre-dump mode CRIU is in a loop and waits for
1085-
// the final DUMP command.
1086-
// The current runc pre-dump approach, however, is
1087-
// start criu in PRE_DUMP once for a single pre-dump
1088-
// and not the whole series of pre-dump, pre-dump, ...m, dump
1089-
// If we got the message CriuReqType_PRE_DUMP it means
1090-
// CRIU was successful and we need to forcefully stop CRIU
1091-
logrus.Debugf("PRE_DUMP finished. Send close signal to CRIU service")
1092-
criuClient.Close()
1093-
// Process status won't be success, because one end of sockets is closed
1094-
_, err := cmd.Process.Wait()
1095-
if err != nil {
1096-
logrus.Debugf("After PRE_DUMP CRIU exiting failed")
1097-
return err
1098-
}
1099-
return nil
1083+
break
11001084
default:
11011085
return fmt.Errorf("unable to parse the response %s", resp.String())
11021086
}
11031087

11041088
break
11051089
}
11061090

1091+
syscall.Shutdown(fds[0], syscall.SHUT_WR)
11071092
// cmd.Wait() waits cmd.goroutines which are used for proxying file descriptors.
11081093
// Here we want to wait only the CRIU process.
11091094
st, err := cmd.Process.Wait()
11101095
if err != nil {
11111096
return err
11121097
}
1113-
if !st.Success() {
1098+
1099+
// In pre-dump mode CRIU is in a loop and waits for
1100+
// the final DUMP command.
1101+
// The current runc pre-dump approach, however, is
1102+
// start criu in PRE_DUMP once for a single pre-dump
1103+
// and not the whole series of pre-dump, pre-dump, ...m, dump
1104+
if !st.Success() && *req.Type != criurpc.CriuReqType_PRE_DUMP {
11141105
return fmt.Errorf("criu failed: %s\nlog file: %s", st.String(), logPath)
11151106
}
11161107
return nil

0 commit comments

Comments
 (0)