From abf9b5186e3e611fdb1bccc5f8c7637ca7c5d3bb Mon Sep 17 00:00:00 2001 From: Rob Hoes Date: Tue, 30 Jul 2013 16:55:38 +0100 Subject: [PATCH] CA-112572: networkd: protect IP watcher thread with an exception handler Signed-off-by: Rob Hoes --- networkd/network_monitor_thread.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/networkd/network_monitor_thread.ml b/networkd/network_monitor_thread.ml index 4c98440f94b..6da0e568cd1 100644 --- a/networkd/network_monitor_thread.ml +++ b/networkd/network_monitor_thread.ml @@ -266,7 +266,6 @@ let ip_watcher () = ); Unix.close writeme; let in_channel = Unix.in_channel_of_descr readme in - debug "Started IP watcher thread"; let rec loop () = let line = input_line in_channel in (* Do not send events for link-local IPv6 addresses, and removed IPs *) @@ -279,7 +278,13 @@ let ip_watcher () = end; loop () in - loop () + while true do + try + info "(Re)started IP watcher thread"; + loop () + with e -> + warn "Error in IP watcher: %s\n%s" (Printexc.to_string e) (Printexc.get_backtrace ()) + done let start () = let dbg = "monitor_thread" in