Encountering '(EXIT) no process' while following introduction to distributed tasks

Hi, I am a beginner and have been following the elixir introduction step-by-step up to Distributed tasks and tags — Elixir v1.17.2 where I am getting this error:

iex(bar@vicomptwo)3> task = Task.Supervisor.async({KV.RouterTasks, :"foo@vicomptwo"}, Kernel, :node, [])
** (exit) exited in: GenServer.call({KV.RouterTasks, :foo@vicomptwo}, {:start_task, [{:bar@vicomptwo, #PID<0.142.0>, #PID<0.142.0>}, :monitor], :temporary, nil}, :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.16.3) lib/gen_server.ex:1114: GenServer.call/3
    (elixir 1.16.3) lib/task/supervisor.ex:546: Task.Supervisor.async/6
    iex:3: (file)

Which steps can I take to debug this issue?
I found some posts about this error in the forums but they seem to be quite complicated compared to what I am doing.

So far I have tried:

iex(foo@vicomptwo)2> Application.ensure_all_started(:kv)
{:ok, []}
iex(foo@vicomptwo)3> Application.start(:kv)
{:error, {:already_started, :kv}}
iex(foo@vicomptwo)4> Application.start(:logger)
{:error, {:already_started, :logger}}

I would expect Application.ensure_all_started(:kv) to return {:ok, [:logger, :kv]}
like is shown in this section of the introduction but I do not if it is related (or what to do about it).

The error is telling you that there is no process named KV.RouterTasks on the foo@... node. That process is the Supervisor process that you’re trying to start the task under, but it doesn’t exist so the call to it fails. There isn’t enough information in your post to say why that’s the case, but that’s what’s wrong.

The application is definitely started, so that’s not the issue, and I assume the nodes are connected properly because otherwise you wouldn’t have made it through the previous section. Perhaps you forgot to place the Supervisor task in the supervision tree (the first step under Distributed tasks)? Or there could be a typo in the name, etc.

Thank you for the additional explanation. I used the graphical observer and indeed KV.RouterTasks was not running on foo@....

This turned out be because I had (embarrassingly, since its not Elixir-related at all) mixed up the two kv/ directories (there is one inside the umbrella project and another outside).

1 Like