CLI/opt/--tcp-close

Revision as of 14:15, 21 July 2017 by Ebatalov (talk | contribs)

Main article: TCP connection

tldr; This option is only used with CRIU restore command. It allows your listening (server) TCP sockets to exist after process tree c/r. It drops all the other TCP connections in the process tree. All your server clients will be able reconnect to its listening sockets created during process tree restore. --tcp-close option allows you to migrate your servers to environments with different ip addresses if your sockets listen on addresses such as 0.0.0.0. Moreover you'll be able to restore many copies of your server on different machines in this case. --tcp-close option works well with another one that allows to change ip addresses of sockets in CRIU image files. It is not implemented yet (https://github.com/xemul/criu/issues/211).

Some details:

All the original process tree sockets data is preserved in process tree image files. --tcp-close option affects all the process tree TCP sockets that have any TCP state except CLOSED and LISTEN. Those affected sockets are restored in CLOSED TCP state (TCP_CLOSE Linux macro). Userspace code that uses those affected sockets will just get errors from its syscalls. Then it would assume that there was a networking/peer problem and it would execute usual error handling code path.