diff options
author | Fengqi Li <lifengqi@inspur.com> | 2022-09-30 09:09:28 +0800 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-10-06 22:05:13 +0200 |
commit | 09e22fec45a67e898deb9ba6dadcdb025c632e12 (patch) | |
tree | e75f02f932aa8f247b5d44b5a8c396df9cd219c5 | |
parent | 53df50db269946a9fe338cdf7793df4438047eb2 (diff) | |
download | openvswitch-09e22fec45a67e898deb9ba6dadcdb025c632e12.tar.gz |
daemon-unix: Fix file descriptor leak when monitor restarts child.
When segmentation fault occurred in ovn-northd, monitor will try to
restart the ovn-northd daemon process every 10s.
Assume the following scenarios: There is a segmentation fault and
the ovn-northd daemon process does not restart properly every time.
New fds are created each time the ovn-northd daemon process is
restarted by the monitor process, but old fds(fd[0]) owned by
the monitor process was not closed properly. One pipe leak for
each restart of the ovn-northd daemon process. After a long time
file descriptors were exhausted.
Fixes: e2ed6fbeb18c ("fatal-signal: Catch SIGSEGV and print backtrace.")
Signed-off-by: Fengqi Li <lifengqi@inspur.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/daemon-unix.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c index 34d45b82a..31db2d2c7 100644 --- a/lib/daemon-unix.c +++ b/lib/daemon-unix.c @@ -393,6 +393,8 @@ monitor_daemon(pid_t daemon_pid) } log_received_backtrace(daemonize_fd); + close(daemonize_fd); + daemonize_fd = -1; /* Throttle restarts to no more than once every 10 seconds. */ if (time(NULL) < last_restart + 10) { |