livebook: Connection timed out trying to connect to Elixir node
Environment
- Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 23 [erts-11.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe] [dtrace]
Elixir 1.11.4 (compiled with Erlang/OTP 23)
- Operating system: MacOS Mojave (10.14.6)
- Livebook version: I cloned main, commit hash
38db12f - How have you started Livebook (mix phx.server, livebook CLI, Docker, etc):
mix phx.server - Browsers that reproduce this bug (the more the merrier): Chrome, Firefox, Vivaldi, Safari
- Include what is logged in the browser console: No messages
- Include what is logged to the server console: No messages that seem to be triggered by the bug
Generated livebook app
21:45:05.867 [info] :alarm_handler: {:set, {:system_memory_high_watermark, []}}
21:45:05.877 [info] :alarm_handler: {:set, {{:disk_almost_full, '/'}, []}}
[Livebook] Application running at http://localhost:8080/?token=<snip>
21:57:05.883 [info] :alarm_handler: {:clear, :system_memory_high_watermark}
Current behavior
- I start the app using the
mix phx.servermethod - Click new notebook and then “Choose a runtime…”
- URL is http://localhost:8080/sessions/kqfxvt2ykazsxqq7mo4aykbomive36xb/settings/runtime
- Click “Elixir Standalone” and then “Connect”
- Websocket message sends:
["7","10","lv:elixir_standalone_runtime","event",{"type":"click","event":"init","value":{"value":""}}] - 10 seconds later Websocket message received:
["7","10","lv:elixir_standalone_runtime","phx_reply",{"response":{"diff":{"0":{"0":"connection timed out","s":["\n <div class=\"error-box\">\n ","\n </div>\n "]}}},"status":"ok"}] - Error message “connection timed out” displays
Expected behavior
- When I start with docker it connects and can run Elixir code as expected
Another case where I see a similar bug is if I try to run Elixir code (which the UI indicates should set up the default runtime for me on first evaluation)
WS message sent: ["4","7","lv:phx-FoBFF3arpEscIwXC","event",{"type":"click","event":"queue_cell_evaluation","value":{"cell_id":"assomaspyq3ekuqsczj37xvaaopj22ju","value":""}}]
WS message received 10 seconds later: [null,null,"lv:phx-FoBFF3arpEscIwXC","diff",{"0":"","1":{"0":"<i class=\"ri-error-warning-line text-2xl\"></i>","1":"Failed to setup runtime - connection timed out","s":["\n <div class=\"flex items-center space-x-2 rounded-lg px-4 py-2 bg-red-100 text-red-400 hover:opacity-75 cursor-pointer\" role=\"alert\"\n phx-click=\"lv:clear-flash\"\n phx-value-key=\"error\">\n","\n <span class=\"whitespace-pre\">","</span>\n </div>\n"]}}]
I appreciate these error messages are quite generic and I’m not getting any useful logs. Happy to run whatever would be helpful to debug this, I’m just not sure where to start! Let me know if I can help at all.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 33 (33 by maintainers)
Commits related to this issue
- Add custom hostname to /etc/hosts to fix Erlang distr. mode Add the custom hostname to the `/etc/hosts` databse to fix Erlang distribution. https://github.com/livebook-dev/livebook/issues/275#issuec... — committed to nickgnd/dotfiles by nickgnd 3 years ago
- Add custom hostname to /etc/hosts to fix Erlang distr. mode Add the custom hostname to the `/etc/hosts` databse to fix Erlang distribution. https://github.com/livebook-dev/livebook/issues/275#issuec... — committed to nickgnd/dotfiles by nickgnd 3 years ago
Actually it should be possible to start with
livebook server --name live@127.0.0.1(with Escript).Fixed the root issue by adding
127.0.0.1 Callums-MacBook-Pro-2to/etc/hosts(https://github.com/elixir-lang/elixir/issues/3955#issuecomment-321924067)Thanks again for all your help!
Cool, thanks. I wanted to rule out an issue with the shell arguments, but that doesn’t seem to be the case.
Oh, ignore me, that’s expected because the parent node is not delivering you the message. In an case, the important part is that the Elixir code is being executed properly, so likely something else is at play.
What happens if you run
iex -S mixinside livebook and try calling this function? https://github.com/elixir-nx/livebook/blob/main/lib/livebook/runtime/elixir_standalone.ex#L32It seems the issue is related to the internals, rather than the UI, so that’s where I would start digging.