Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Livebook Desktop for Mac app crashes on startup when hostname contains whitespace #1850

Closed
cgrothaus opened this issue Apr 6, 2023 · 7 comments · Fixed by #1894
Closed
Labels
area:desktop Related to Livebook desktop app chore Technical changes

Comments

@cgrothaus
Copy link

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
    • Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
    • Elixir 1.14.3 (compiled with Erlang/OTP 25)
  • Operating system: macOS Ventura 13.3
  • How have you started Livebook: Livebook Desktop standalone macOS application
  • Livebook version: 0.9.0
  • Browsers that reproduce this bug (the more the merrier): irrelevant - bug happens at startup of standalone macOS application
  • Include what is logged in the browser console: -
  • Include what is logged to the server console: in ~/Library/Logs/Livebook.log:
[LivebookLauncher] release pid: 72884
=INFO REPORT==== 25-Aug-2022::09:39:38.734689 ===
Can't set short node name!
Please check your configuration

=SUPERVISOR REPORT==== 25-Aug-2022::09:39:38.734712 ===
    supervisor: {local,net_sup}
    errorContext: start_error
    reason: {'EXIT',nodistribution}
    offender: [{pid,undefined},
               {id,net_kernel},
               {mfargs,{net_kernel,start_link,
                                   [#{clean_halt => true,name => livebook_app,
                                      name_domain => shortnames,
                                      supervisor => net_sup}]}},
               {restart_type,permanent},
               {significant,false},
               {shutdown,2000},
               {child_type,worker}]

{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}})

Crash dump is being written to: erl_crash.dump...done

Current behavior

My company macbook was set up in a way that the hostname is something like Christoph Grothauss Mac, i.e. the hostname contains whitespace. This leads to a crash when starting up livebook, stating that the short node name cannot be set.

Temporary Workaround

Configure the hostname to not contain whitespace.

Expected behavior

The livebook macOS application can cope with hostnames that contain whitespaces and starts up successfully.

@josevalim
Copy link
Contributor

Thank you for the report @cgrothaus.

Honestly, I am a bit puzzled to why Apple allows a space in the hostname, as that is not allowed in the specification: https://datatracker.ietf.org/doc/html/rfc952

The error itself is coming from Erlang, and we could try to request them to allow such names, but I am also skeptical about changing Erlang to support a hostname that goes against the RFC.

@cgrothaus
Copy link
Author

Thanks for the clarification @josevalim.

You're right, Apple is doing something fishy here. I should have come to that conclusion myself.

Perhaps checking the launcher script (I assume there is one that kicks of the beam) for this illegal situation and displaying a warning is an option? Or do you think this is too much special case handling for a rare bug?

@josevalim
Copy link
Contributor

We will see how we can improve the desktop app in this case to make sure it is logged. If it helps anyone, I can reproduce the issue with sudo scutil --set HostName "best mac".

@josevalim josevalim added chore Technical changes area:desktop Related to Livebook desktop app labels Apr 6, 2023
@sultaniman
Copy link

On my macOS I got the following issue, I thought it would be localhost by default but it picked up something from configuration which I don't know about and is not /etc/hosts, had to set hostname manually and restart my laptop for livebook to come back and run.

[Livebook] Application running at http://localhost:64481/?token=lbnkbxj5cz4ehnluxdeqkbfzsufnc72m
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
[Livebook] Application running at http://localhost:63243/?token=2xhhsrf4imqge7fichb4uktu6nnoi2ke
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed
Protocol 'inet_tcp': the name livebook_app@Sultans-MBP seems to be in use by another Erlang node
Protocol 'inet_tcp': the name livebook_app@Sultans-MBP seems to be in use by another Erlang node
[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed

ERROR!!! [Livebook] Your hostname "Sultans-MBP" does not resolve to a loopback address (127.0.0.0/8), which indicates something wrong in your OS configuration, or EPMD is not running.

To address this issue, you might:

  * Consult our Installation FAQ:
    https://github.com/livebook-dev/livebook/wiki/Installation-FAQ

  * If you are using Livebook's CLI or from source, consider using longnames:

        livebook server --name [email protected]
        elixir --name [email protected] -S mix phx.server

  * If the issue persists, please file a bug report


[os_mon] memory supervisor port (memsup): Erlang has closed
[os_mon] cpu supervisor port (cpu_sup): Erlang has closed

@wojtekmach
Copy link
Contributor

If it helps anyone, I can reproduce the issue with sudo scutil --set HostName "best Mac".

@josevalim yeah I was able to reproduce the issue and I got the error dialog and the following was logged:

=INFO REPORT==== 4-May-2023::13:25:48.736848 ===
Can't set short node name!
Please check your configuration

=SUPERVISOR REPORT==== 4-May-2023::13:25:48.736863 ===
    supervisor: {local,net_sup}
    errorContext: start_error
    reason: {'EXIT',nodistribution}
    offender: [{pid,undefined},
               {id,net_kernel},
               {mfargs,{net_kernel,start_link,
                                   [#{clean_halt => true,name => livebook_app,
                                      name_domain => shortnames,
                                      supervisor => net_sup}]}},
               {restart_type,permanent},
               {significant,false},
               {shutdown,2000},
               {child_type,worker}]

{"Kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'EXIT',nodistribution}}}}},{kernel,start,[normal,[]]}}})

so yeah, not super helpful. Any pointers how we could go about improving the experience?

@josevalim
Copy link
Contributor

@wojtekmach could we check something either in the .sh.eex file or in the Swift script for empty spaces in host names?

@wojtekmach
Copy link
Contributor

Yeah, a .sh.eex check is the easiest way to go about this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:desktop Related to Livebook desktop app chore Technical changes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants