mat-hek
Membrane Core Team
Hi there,
I’d like to start_link a GenServer like this:
:rpc.call(node, GenServer, :start_link, [MyServer, options])
however, this fails, because the server gets linked to some process started by :rpc.call, not to the process that executes the call. How do I solve this?
Trending in Questions
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hello,
I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind.
However, when I launch mix phx.server, I get an error...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
I’m working on a small exercise involving update_in/3, and I came up with this solution:
data = %{
name: "Periodic Table",
category:...
New
How Can I Optimise Compile Time Dependencies
I have been building an elixir application for about 2 years now. Many modules and files ha...
New
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #ai
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #metaprogramming










Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachallaun
Can you start the GenServer and link to the resulting pid in a separate step using process.link?
mat-hek
I could, but it won’t be atomic. If the server crashes before I link it, the call to
Process.linkwill raise an error. Even if I catch the error, what feels smelly, I won’t get the EXIT signal with the reason for the crash, which is sometimes needed.al2o3cr
This sounds like exactly the scenario that
spawn_request/5was added to OTP 23 to address.mat-hek
Hmm, interesting, but can’t see how to use this to spawn a GenServer, which only offers
startandstart_link…zachallaun
From my reading, you’d do something like
mat-hek
Thanks, I definitely misunderstood the docs. And it seems I still don’t get how this is supposed to work…
When I spawn a task, it seems to work (using Task for simplicity)
On the other node, the process is not alive though
While the task is spawned under another PID
Another problem is that the
:linkoption doesn’t seem to workEDIT: ok I see that now. When
spawn_requestis called, some process is spawned on another node. If the link option is passed, the link is created to that process. Then, the spawned process spawns the actual process I want. So, to my understanding, this doesn’t establish a link to the GenServer/Task. Moreover, I need some additional logic to retrieve its PID.zachallaun
What about starting the remote process with a function that calls
start_link, returning the started process? You now have a “link chain” with the intermediary process linked to both your local process and remote GenServer, right? (Not tested.)This doesn’t seem very pretty, but my goal at this point is figuring out something that works first.
Surely there has to be a better way though. Feels like we’re both missing something
Note: not tested, on phone.
mat-hek
Yeah, I think this would be done easier by using
Node.spawn_link. The intermediary process should also trap exits, otherwise, it won’t be notified about exit with the reason:normal. Also, killing the intermediary process wouldn’t immediately kill the target process, as the exit signal can be trapped when it’s not ‘direct’ - this would have to be worked around if needed. As well as probably a couple more quirks I didn’t think of