From b6c7ce1874551455b877977f0425bd016f2e1466 Mon Sep 17 00:00:00 2001 From: tiamo0 Date: Wed, 15 Dec 2021 10:37:07 +0800 Subject: [PATCH] If client exit abnormally, close lxc-attach mainloop. Signed-off-by: tiamo0 --- ...bnormally-close-main-loop-avoid-proc.patch | 30 +++++++++++++++++++ lxc.spec | 7 +++++ series.conf | 1 + 3 files changed, 38 insertions(+) create mode 100644 0035-If-client-exit-abnormally-close-main-loop-avoid-proc.patch diff --git a/0035-If-client-exit-abnormally-close-main-loop-avoid-proc.patch b/0035-If-client-exit-abnormally-close-main-loop-avoid-proc.patch new file mode 100644 index 0000000..44738cd --- /dev/null +++ b/0035-If-client-exit-abnormally-close-main-loop-avoid-proc.patch @@ -0,0 +1,30 @@ +From d7eb77bd49be902d605130ab1deea5d495feea2f Mon Sep 17 00:00:00 2001 +From: tiamo0 +Date: Wed, 15 Dec 2021 10:25:04 +0800 +Subject: [PATCH] If client exit abnormally, close main loop avoid process + leak. + +Signed-off-by: tiamo0 +--- + src/lxc/terminal.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c +index 5d83691..6286b6d 100644 +--- a/src/lxc/terminal.c ++++ b/src/lxc/terminal.c +@@ -780,9 +780,9 @@ int lxc_terminal_io_cb(int fd, uint32_t events, void *data, + close(fd); + return LXC_MAINLOOP_CONTINUE; /* isulad: do not close mainloop when peer close*/ + } else if (lxc_terminal_is_fifo(fd, &terminal->fifos)) { +- /* isulad: delete fifos when the client close */ ++ /* isulad: delete fifos when the client close, and close mainloop */ + lxc_terminal_delete_fifo(fd, &terminal->fifos); +- return LXC_MAINLOOP_CONTINUE; ++ return LXC_MAINLOOP_CLOSE; + } else if (fd == terminal->pipes[1][0] || fd == terminal->pipes[2][0]) { + if (fd == terminal->pipes[1][0]) { + if (terminal->log_fd >= 0) { +-- +2.30.0 + diff --git a/lxc.spec b/lxc.spec index b88a005..8fc42f5 100644 --- a/lxc.spec +++ b/lxc.spec @@ -42,6 +42,7 @@ Patch0031: 0031-fix-lsm_se_mount_context-memory-leak.patch Patch0032: 0032-disable-lxc_keep-with-oci-image.patch Patch0033: 0033-conf-ensure-that-the-idmap-pointer-itself-is-freed.patch Patch0034: 0034-cgfsng-fix-cgroup-attach-cgroup-creation.patch +Patch0035: 0035-If-client-exit-abnormally-close-main-loop-avoid-proc.patch BuildRequires: systemd-units git libtool graphviz docbook2X doxygen chrpath BuildRequires: pkgconfig(libseccomp) @@ -213,6 +214,12 @@ make check %{_mandir}/*/man7/%{name}* %changelog +* Wed Dec 15 2021 tiamo0 - 4.0.3-2021121501 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:close lxc-attach mainloop if client exit abnormally + * Thu Nov 25 2021 wangfengtu - 4.0.3-2021112501 - Type:bugfix - ID:NA diff --git a/series.conf b/series.conf index cffc900..1e628ef 100644 --- a/series.conf +++ b/series.conf @@ -32,3 +32,4 @@ 0032-disable-lxc_keep-with-oci-image.patch 0033-conf-ensure-that-the-idmap-pointer-itself-is-freed.patch 0034-cgfsng-fix-cgroup-attach-cgroup-creation.patch +0035-If-client-exit-abnormally-close-main-loop-avoid-proc.patch -- Gitee