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

Reevaluating a cell containing Kino.start_child! sometimes errors with "Already started" #397

Open
jyc opened this issue Feb 13, 2024 · 5 comments

Comments

@jyc
Copy link

jyc commented Feb 13, 2024

Hello!

Thanks for making Kino.

I'm using some GenServers inside of a Livebook notebook. I have an Elixir cell which contains a call to Kino.start_child!/1.

Weirdly, sometimes when I reevaluate the cell, it works fine and I get #PID<0.4995.0>. Other times I get an error about a process already being started.

Do you know what's going on? Unfortunately the error is nondeterministic so I'm unable to create a minimal reproducible example, but I'm happy to help investigate.

@josevalim
Copy link
Contributor

Can you provide the stacktrace as well?

Even if not consistent, can you provide the code? Or can you tell us if it happens if you have a very simple GenServer as children? The reason I ask is because when we re-execute a cell, we terminate all previous children. So I can think of two options here:

  1. Livebook has a bug
  2. Your GenServer is starting another GenServer (or another process) inside of it and that one is not terminated correctly

@jyc
Copy link
Author

jyc commented Feb 14, 2024

Sorry for the delay! I will provide a stacktrace the next time it happens! The structure of the code looks like this:

Elixir cell 1: define a GenServer
Elixir cell 2: start that GenServer using Kino.start_child!/1, assign it a name
Elixir cell 3: call that GenServer by name

The GenServer does not start any other GenServers, but it does call other ones, also by name, if that matters!

@jonatanklosko
Copy link
Member

Do you call Kino.start_child!/1 directly in the code cell, or from within some other process?

Also, for the reference, what Kino and Livebook versions do you use?

@josevalim
Copy link
Contributor

@jyc ping :)

@jyc
Copy link
Author

jyc commented Mar 25, 2024

Do you call Kino.start_child!/1 directly in the code cell, or from within some other process?

Directly in the code cell!

Also, for the reference, what Kino and Livebook versions do you use?

v0.12.1

I've been using Elixir for a component of my current project that I haven't touched in a month, because I've been working on other components. So unfortunately I don't have any new stacktraces to give you. But I expect to get back to the Elixir part soon!

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

3 participants