When segmentation fault occured 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 doen not restart properly everytime.
New fds are created each time the ovn-northd daemon process is
restarted by the monitor process, but old fds(fd[1]) ownered by
the monitor process was not closed properly. One pipe leak for
each restart of the ovn-northd daemon process. After a long time
the OS's pipe was exhausted.
Fixes: e2ed6fbeb18c("fatal-signal:Catch SIGSEGV and print backtrace.")

Signed-off-by: Fengqi Li <[email protected]>
---
 lib/daemon-unix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c
index 52f3d4bc6..1a7ba427d 100644
--- a/lib/daemon-unix.c
+++ b/lib/daemon-unix.c
@@ -396,6 +396,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) {
-- 
2.27.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to