From f20b2c6f8d4ca87b15bb6b06f18695034f9d1ba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonatan=20K=C5=82osko?= Date: Wed, 15 Jan 2025 11:49:39 +0100 Subject: [PATCH] Improve messages on standalone runtime init failure (#2912) --- lib/livebook/runtime/standalone.ex | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/livebook/runtime/standalone.ex b/lib/livebook/runtime/standalone.ex index 5860a09074f..424e64bf791 100644 --- a/lib/livebook/runtime/standalone.ex +++ b/lib/livebook/runtime/standalone.ex @@ -108,6 +108,8 @@ defmodule Livebook.Runtime.Standalone do port_ref = Port.monitor(port) loop = fn loop -> + # Note that the child node terminates when communication times out, + # so we should always receive either a message or :DOWN event. receive do {:node_started, init_ref, ^child_node, child_port, primary_pid} -> Port.demonitor(port_ref) @@ -122,11 +124,8 @@ defmodule Livebook.Runtime.Standalone do {:DOWN, ^port_ref, :port, _object, reason} -> {:error, - "Elixir terminated unexpectedly, please check your logs for errors. Reason: #{inspect(reason)}"} - after - # Use a longer timeout to account for longer child node startup. - 30_000 -> - {:error, "connection timed out"} + "standalone runtime node (#{inspect(child_node)}) terminated unexpectedly on startup, " <> + "please check your logs for errors. Reason: #{inspect(reason)}"} end end @@ -165,8 +164,8 @@ defmodule Livebook.Runtime.Standalone do after 10_000 -> IO.puts( - "Error: timeout during initial communication between standalone runtime" <> - " (node: #{inspect(node())}) and Livebook (node: #{inspect(parent_node)})." + "Error: timeout during initial communication between standalone runtime " <> + "(node: #{inspect(node())}) and Livebook (node: #{inspect(parent_node)})." ) :timeout