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
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
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
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #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