Skip to content

Commit 9f13a29

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 <[email protected]>
1 parent acae188 commit 9f13a29

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

libcontainer/container_linux.go

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,38 +1065,28 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts *
10651065
continue
10661066
case t == criurpc.CriuReqType_RESTORE:
10671067
case t == criurpc.CriuReqType_DUMP:
1068-
break
10691068
case t == criurpc.CriuReqType_PRE_DUMP:
1070-
// In pre-dump mode CRIU is in a loop and waits for
1071-
// the final DUMP command.
1072-
// The current runc pre-dump approach, however, is
1073-
// start criu in PRE_DUMP once for a single pre-dump
1074-
// and not the whole series of pre-dump, pre-dump, ...m, dump
1075-
// If we got the message CriuReqType_PRE_DUMP it means
1076-
// CRIU was successful and we need to forcefully stop CRIU
1077-
logrus.Debugf("PRE_DUMP finished. Send close signal to CRIU service")
1078-
criuClient.Close()
1079-
// Process status won't be success, because one end of sockets is closed
1080-
_, err := cmd.Process.Wait()
1081-
if err != nil {
1082-
logrus.Debugf("After PRE_DUMP CRIU exiting failed")
1083-
return err
1084-
}
1085-
return nil
10861069
default:
10871070
return fmt.Errorf("unable to parse the response %s", resp.String())
10881071
}
10891072

10901073
break
10911074
}
10921075

1076+
syscall.Shutdown(fds[0], syscall.SHUT_WR)
10931077
// cmd.Wait() waits cmd.goroutines which are used for proxying file descriptors.
10941078
// Here we want to wait only the CRIU process.
10951079
st, err := cmd.Process.Wait()
10961080
if err != nil {
10971081
return err
10981082
}
1099-
if !st.Success() {
1083+
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 !st.Success() && *req.Type != criurpc.CriuReqType_PRE_DUMP {
11001090
return fmt.Errorf("criu failed: %s\nlog file: %s", st.String(), logPath)
11011091
}
11021092
return nil

0 commit comments

Comments
 (0)