Skip to content

Commit

Permalink
Improve messages on standalone runtime init failure
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanklosko committed Jan 15, 2025
1 parent e01abae commit 8324fcb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/livebook/runtime/standalone.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8324fcb

Please sign in to comment.