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:16 +0200 |
commit | b0154891fa2583ecd8f111683c81f1a30c7a23aa (patch) | |
tree | 35a5adbdbbf3312ac196d851955cde78f5ee9900 | |
parent | 4c26aab8df884ac8a3e4bb242aec69113e416800 (diff) | |
download | openvswitch-b0154891fa2583ecd8f111683c81f1a30c7a23aa.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 4e2874c22..b9964fa18 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) { |