livebook: Starting a standalone Elixir runtime fails on Windows 10

As stated in the title, starting a standalone Elixir runtime / node seems to fail on Windows 10. When attempting to click on the “Connect” button in the Liveview UI, the following error comes up in the terminal:

iex(livebook_j35nq3mw@2080-OMG)1> [error] GenServer #PID<0.461.0> terminating
** (MatchError) no match of right hand side value: {:error, "Elixir process terminated unexpectedly"}
    (livebook 0.1.0) lib/livebook_web/live/session_live/elixir_standalone_live.ex:42: LivebookWeb.SessionLive.ElixirStandaloneLive.handle_event/3
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/channel.ex:338: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
    (telemetry 0.4.2) c:/Users/juha/projects/elixir/livebook/deps/telemetry/src/telemetry.erl:262: :telemetry.span/3
    (phoenix_live_view 0.15.4) lib/phoenix_live_view/channel.ex:203: Phoenix.LiveView.Channel.handle_info/2
    (stdlib 3.8) gen_server.erl:637: :gen_server.try_dispatch/4
    (stdlib 3.8) gen_server.erl:711: :gen_server.handle_msg/6
    (stdlib 3.8) proc_lib.erl:259: :proc_lib.wake_up/3
Last message: %Phoenix.Socket.Message{event: "event", join_ref: "32", payload: %{"event" => "init", "type" => "click", "value" => %{"value" => ""}}, ref: "34", topic: "lv:elixir_standalone_runtime"}
State: %{components: {%{}, %{}, 1}, join_ref: "32", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<assigns: %{current_runtime: nil, flash: %{}, live_action: nil, output: nil, session_id: "iamnw6urrqdqeugvmnbby44m3rvl2rr6"}, changed: %{}, endpoint: LivebookWeb.Endpoint, id: "elixir_standalone_runtime", parent_pid: #PID<0.456.0>, root_pid: #PID<0.456.0>, router: LivebookWeb.Router, view: LivebookWeb.SessionLive.ElixirStandaloneLive, ...>, topic: "lv:elixir_standalone_runtime", transport_pid: #PID<0.449.0>, upload_names: %{}, upload_pids: %{}}

The same behaviour can be encountered when calling Livebook.Runtime.ElixirStandalone.init() directly via iex. The process managing the startup of the node seems to immediately return with :DOWN, so something seems to be going wrong in the startup there.

What does work for me on my Windows 10 system is manually starting an “attached node” via iex --sname test.

For the sake of further debugging, I’ve called IO.inspect([elixir_path: elixir_path, node_name: node_name, eval: eval]) within the Livebook.Runtime.ElixirStandalone.start_elixir_node function when clicking the connect button. The results, as seen in the Windows 10 command prompt, are as follows:

[
  elixir_path: "c:/Program Files (x86)/Elixir/bin/elixir.bat",
  node_name: :"livebook_runtime_3ouxkwak@2OMG",
  eval: "(\n  init_ref = make_ref()\n  parent_process = {:livebook_parent_process_name_ek5c2dts, :\"livebook_j35nq3mw@2080-OMG\"}\n  send(parent_process, {:node_started, init_ref, node(), self()})\n  receive do\n    {:node_initialized, ^init_ref} ->\n      manager_ref = Process.monitor(Livebook.Runtime.ErlDist.Manager)\n      receive do\n        {:DOWN, ^manager_ref, :process, _object, _reason} ->\n          :ok\n      end\n  after\n    10000 ->\n      :timeout\n  end\n)"
]

Perhaps the issue is caused by a Windows security policy that prevents certain things from being run here? I don’t normally use Windows as my development environment, so I might be way off with my reasoning here.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 23 (23 by maintainers)

Commits related to this issue

Most upvoted comments

The second issue was around newlines but it is addressed now. Thank you @juhalehtonen ❤️ and Windows should be good to go @samaaron!

I am sending you an email. 😄