From 221c797241a49bb6ef1d15be5dd28dfcae87314b Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 17 Jan 2016 13:19:40 +0000 Subject: [PATCH] Survive death of GUId connection We don't need the GUI anyway. Error was: Fatal error: exception Failure("End-of-file from GUId in dom0") Raised at file "pervasives.ml", line 30, characters 22-33 Called from file "src/core/lwt.ml", line 754, characters 44-47 Mirage exiting with status 2 Do_exit called! --- unikernel.ml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/unikernel.ml b/unikernel.ml index c2a5a8b..c644971 100644 --- a/unikernel.ml +++ b/unikernel.ml @@ -41,6 +41,19 @@ module Main (Clock : V1.CLOCK) = struct Uplink.listen uplink router ] + (* We don't use the GUI, but it's interesting to keep an eye on it. + If the other end dies, don't let it take us with it (can happen on log out). *) + let watch_gui gui = + Lwt.async (fun () -> + Lwt.try_bind + (fun () -> GUI.listen gui) + (fun `Cant_happen -> assert false) + (fun ex -> + Log.warn (fun f -> f "GUI thread failed: %s" (Printexc.to_string ex)); + return () + ) + ) + (* Control which of the messages that reach the reporter are logged to the console. The rest will be displayed only if an error occurs. Note: use the regular [Logs] configuration settings to determine which messages @@ -59,7 +72,7 @@ module Main (Clock : V1.CLOCK) = struct qrexec >>= fun qrexec -> let agent_listener = RExec.listen qrexec Command.handler in gui >>= fun gui -> - Lwt.async (fun () -> GUI.listen gui); + watch_gui gui; qubesDB >>= fun qubesDB -> Log.info (fun f -> f "agents connected in %.3f s (CPU time used since boot: %.3f s)" (Clock.time () -. start_time) (Sys.time ()));