I have connected 2 nodes and spawned a process from one node to another using Node.spawn_link. When i shut my parent node my remote node still keeps on executing the spawned process. How can i stop the remote node along with the parent node.
Linked processes will die, but nodes will not. A node is like an OS, it does not die just become some Process dies. ^.^
If you want to shut down the Node, the proper command is: :init.stop()
Just either call that from the node to shut down, or RPC the command over.
Just to clarify:
When you say you “shut my parent node down”, do you mean you actually exit the BEAM VM? Or you stop the (Elixir) process on the VM?
In Beam parlance:
A Node is the running Operating System BEAM process.
A Process is a running microthread that is running inside the BEAM process.
Thus calling :init.stop()
safely and properly shuts down the entire operating system process, the beam vm itself shuts down.