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:14 +0200 |
commit | a8c92a2bbcf4d591ba75e241bc2ccb7da6a39c67 (patch) | |
tree | 20bbbdc14ab7265d4764d1a888d4f0688c83700d | |
parent | 917f72a4a8df4910d0ebcb78a18cbf1ad77c50cf (diff) | |
download | openvswitch-a8c92a2bbcf4d591ba75e241bc2ccb7da6a39c67.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) { |