Skip to content

Commit 93a8ed7

Browse files
committed
CA-112572: networkd: protect IP watcher thread with an exception handler
Signed-off-by: Rob Hoes <[email protected]>
1 parent b68cf9b commit 93a8ed7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

networkd/network_monitor_thread.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ let ip_watcher () =
259259
);
260260
Unix.close writeme;
261261
let in_channel = Unix.in_channel_of_descr readme in
262-
debug "Started IP watcher thread";
263262
let rec loop () =
264263
let line = input_line in_channel in
265264
(* Do not send events for link-local IPv6 addresses, and removed IPs *)
@@ -272,7 +271,13 @@ let ip_watcher () =
272271
end;
273272
loop ()
274273
in
275-
loop ()
274+
while true do
275+
try
276+
info "(Re)started IP watcher thread";
277+
loop ()
278+
with e ->
279+
warn "Error in IP watcher: %s\n%s" (Printexc.to_string e) (Printexc.get_backtrace ())
280+
done
276281

277282
let start () =
278283
let dbg = "monitor_thread" in

0 commit comments

Comments
 (0)