[CRIU] [PATCH] criu: add an option to skip in-flight connections
Andrew Vagin
avagin at virtuozzo.com
Tue Jun 14 10:47:32 PDT 2016
On Tue, Jun 14, 2016 at 07:13:26AM +0000, Adrian Reber wrote:
> From: Adrian Reber <areber at redhat.com>
>
> Trying to migrate containers with tomcat and running ab as a test client
> (ab -n 1000000 -c 20 http://url/to/test) criu sometimes exited with an
> error if in-flight connections were detected. Criu can handle sockets
> listening and with established connection. In-flight connections can
> happen on sockets which do not yet have a full established connection
> (SYN, SYN-ACK, and the last ACK is missing).
>
> This adds a new option to criu:
>
> --skip-in-flight this option skips in-flight TCP connections.
> if TCP connections are found which are not yet completely
> established, criu will ignore these connections in favor
> of erroring out.
>
> With this option criu will skip sockets in this state and let's the client
> handle the re-connection.
>
Acked-by: Andrew Vagin <avagin at virtuozzo.com>
> Signed-off-by: Adrian Reber <areber at redhat.com>
> ---
> criu/crtools.c | 9 +++++++++
> criu/include/cr_options.h | 1 +
> criu/include/sk-inet.h | 1 +
> criu/sk-inet.c | 7 +++++++
> 4 files changed, 18 insertions(+)
>
> diff --git a/criu/crtools.c b/criu/crtools.c
> index b7b205c..5729fc3 100644
> --- a/criu/crtools.c
> +++ b/criu/crtools.c
> @@ -324,6 +324,7 @@ int main(int argc, char *argv[], char *envp[])
> { "cgroup-props", required_argument, 0, 1080 },
> { "cgroup-props-file", required_argument, 0, 1081 },
> { "cgroup-dump-controller", required_argument, 0, 1082 },
> + { SK_INFLIGHT_PARAM, no_argument, 0, 1083 },
> { },
> };
>
> @@ -635,6 +636,10 @@ int main(int argc, char *argv[], char *envp[])
> if (!cgp_add_dump_controller(optarg))
> return 1;
> break;
> + case 1083:
> + pr_msg("Will skip in-flight TCP connections\n");
> + opts.tcp_skip_in_flight = true;
> + break;
> case 'V':
> pr_msg("Version: %s\n", CRIU_VERSION);
> if (strcmp(CRIU_GITID, "0"))
> @@ -862,6 +867,10 @@ usage:
> "* Special resources support:\n"
> " -x|--" USK_EXT_PARAM "inode,.." " allow external unix connections (optionally can be assign socket's inode that allows one-sided dump)\n"
> " --" SK_EST_PARAM " checkpoint/restore established TCP connections\n"
> +" --" SK_INFLIGHT_PARAM " this option skips in-flight TCP connections.\n"
> +" if TCP connections are found which are not yet completely\n"
> +" established, criu will ignore these connections in favor\n"
> +" of erroring out.\n"
> " -r|--root PATH change the root filesystem (when run in mount namespace)\n"
> " --evasive-devices use any path to a device file if the original one\n"
> " is inaccessible\n"
> diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
> index e36c362..1d47909 100644
> --- a/criu/include/cr_options.h
> +++ b/criu/include/cr_options.h
> @@ -111,6 +111,7 @@ struct cr_options {
> unsigned int timeout;
> unsigned int empty_ns;
> bool lazy_pages;
> + bool tcp_skip_in_flight;
> };
>
> extern struct cr_options opts;
> diff --git a/criu/include/sk-inet.h b/criu/include/sk-inet.h
> index 4707a6e..9d2bda6 100644
> --- a/criu/include/sk-inet.h
> +++ b/criu/include/sk-inet.h
> @@ -72,6 +72,7 @@ extern int dump_one_tcp(int sk, struct inet_sk_desc *sd);
> extern int restore_one_tcp(int sk, struct inet_sk_info *si);
>
> #define SK_EST_PARAM "tcp-established"
> +#define SK_INFLIGHT_PARAM "skip-in-flight"
>
> extern int check_tcp(void);
>
> diff --git a/criu/sk-inet.c b/criu/sk-inet.c
> index 20c6535..dfcfae6 100644
> --- a/criu/sk-inet.c
> +++ b/criu/sk-inet.c
> @@ -144,6 +144,11 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk)
> switch (sk->state) {
> case TCP_LISTEN:
> if (sk->rqlen != 0) {
> + if (opts.tcp_skip_in_flight) {
> + pr_info("Skipping in-flight connection (l) for %x\n",
> + sk->sd.ino);
> + break;
> + }
> /*
> * Currently the ICONS nla reports the conn
> * requests for listen sockets. Need to pick
> @@ -151,6 +156,8 @@ static int can_dump_inet_sk(const struct inet_sk_desc *sk)
> */
> pr_err("In-flight connection (l) for %x\n",
> sk->sd.ino);
> + pr_err("In-flight connections can be ignored with the"
> + "--%s option.\n", SK_INFLIGHT_PARAM);
> return 0;
> }
> break;
> --
> 1.8.3.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list