Crowdhailer
Legitimate reasons to use unlinked processes in production
Pretty much as the title says. Is there any reason to start a process unlinked to any other process, particularly if that process is long lived. i.e. When have you used GenServer.start over GenServer.start_link.
Most Liked
josevalim
That is still not a valid reason because you can still put it under a supervisor and tell the supervisor to not care about failures at all.
So even if the job of a process is completely discardable, you should still start it under a supervision tree because it gives you visibility of your application structure and give you sane shutdown semantics (even if the semantics is kill them all).
sasajuric
This is IMO the most important reason for start_link. If you use plain start, there’s always a chance you’ll leave some dangling process behind, and that might cause various weird behaviour.
This is why a worker should sit under a supervisor even if you don’t want to restart it. Because supervisors are not just about restarting, but also about synchronized starting in the proper order, as well as proper termination and cleanup.
OvermindDL1
Except that within the OTP supervision framework it is easy to introspect and get information about. I’ve been of the opinion for over a decade that every-single-process should be supervised or linked somewhere.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










