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

Can't get the Leaflet.js example to run in Attached mode. #1131

Closed
rugyoga opened this issue Apr 18, 2022 · 12 comments
Closed

Can't get the Leaflet.js example to run in Attached mode. #1131

rugyoga opened this issue Apr 18, 2022 · 12 comments

Comments

@rugyoga
Copy link

rugyoga commented Apr 18, 2022

Environment

  • Operating system: MacOS Monterey (12.3.1)
  • elixir 1.13.4-otp-24
  • erlang 24.3.3

Current behavior

I can run the example in the Dynamic maps with Leaflet section with no issue.
I can copy and paste that code to a new LiveBook and run it in Elixir standalone mode with no issue.
But when I try and incorporate it into an existing mix project and run it in Attached mode, I get:

map = Kino.Leaflet.new({51.505, -0.09}, 13)
  • Include what is logged to the server console:
** (exit) exited in: GenServer.call(Kino.DynamicSupervisor, {:start_child, {{Kino, :__start_override__, [{Kino.JS.LiveServer, :start_link, [{Kino.Leaflet, {[51.505, -0.09], 13}, "dtqrdlpxg3ufens5qg4gnhdsbsv6seju"}]}, #PID<0.1176.0>, #PID<0.1177.0>]}, :permanent, 5000, :worker, [Kino]}}, :infinity)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (elixir 1.13.4) lib/gen_server.ex:1019: GenServer.call/3
    lib/kino/js/live.ex:230: Kino.JS.Live.new/2

I moved the Kino dependency into the mix.exs.
Is there some other incantation I need to perform.
Didn't see anything in the doc.

  • Built livebook via: mix escript.install github livebook-dev/livebook
  • Browsers that reproduce this bug (the more the merrier): Chrome
  • How have you started Livebook (mix phx.server, livebook CLI, Docker, etc): livebook server
  • Livebook version (use git rev-parse HEAD if running with mix):
% livebook --version
Erlang/OTP 24 [erts-12.3.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Elixir 1.13.4 (compiled with Erlang/OTP 24)

Livebook 0.5.2
@jonatanklosko
Copy link
Member

jonatanklosko commented Apr 18, 2022

Hey @rugyoga, how exactly do you start the node you attach to? It should work if you add :kino to dependencies in mix.exs, then either use the Mix runtime, or the Attached runtime with node started as iex --sname test --cookie mycookie -S mix.

@rugyoga
Copy link
Author

rugyoga commented Apr 18, 2022

When I use the Attached runtime, all my other code works fine but the section with Leaflet.js barfs as reported.

I click on Runtime settings
Click the gear icon.
Select the Attached Node and copy over the Name and the Cookie.
Ever other cell works fine except the Leaflet.js code which is copied
verbatim from the Kino examples (except omitting the Mix.install in the first cell).

I start iex by doing:

iex --cookie $COOKIE --sname $NAME -S mix

@jonatanklosko
Copy link
Member

How do you start the node? The error indicates that the Kino application is not started :)

@rugyoga
Copy link
Author

rugyoga commented Apr 18, 2022

Do I need to explicitly start Kino in my application code?

@jonatanklosko
Copy link
Member

If you added it as {:kino, "~> 0.5.2"} it shouldn't be needed, but it depends on how you start the node. Is your application supervision tree started?

@rugyoga
Copy link
Author

rugyoga commented Apr 18, 2022

I believe so, because all the other components in the supervision tree are responsive.
But my supervision tree fu isn't the strongest so it's possible something went awry.
How do I inspect the supervision tree and look for anomalies?
Or start it explicitly?

@jonatanklosko
Copy link
Member

Hmm, I don't see why the kino application wouldn't start then. I've just tried that with a fresh Mix project and it works as expected. @josevalim any ideas?

@rugyoga
Copy link
Author

rugyoga commented Apr 18, 2022

Can I start the Kino instance explicitly?

@jonatanklosko
Copy link
Member

Yeah, doing Application.ensure_all_started(:kino) in the notebook or on application start should help, but this shouldn't be necessary 🤔

@rugyoga
Copy link
Author

rugyoga commented Apr 18, 2022

^ That fixed it. I'll review our start up code at the next opportunity. Probably something funky going on there.

@jonatanklosko
Copy link
Member

FTR this should work:

  1. mix new testproject
  2. Add {:kino, "~> 0.5.2"} to deps in mix.exs
  3. mix deps.get
  4. iex --sname test --cookie mycookie -S mix
  5. Connect to the node via Attached runtime

@rugyoga
Copy link
Author

rugyoga commented Apr 19, 2022

Thanks for your help!
I'm going to close this as i'm 99% sure it's an issue in the creation of our app's supervision tree.

@rugyoga rugyoga closed this as completed Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants