aungmyooo2k17

aungmyooo2k17

How Supervisor Behavior in Elixir Umbrella Apps: Managing Failures Across Applications

In Elixir umbrella apps, when an error occurs in one application (e.g., appA) and its supervisor determines that the error cannot be recovered, the supervisor might terminate the entire umbrella application, affecting not only appA but also appB. I want to know how supervisors work within umbrella apps, their fault-tolerance strategies, and how to handle such scenarios effectively.

I check the supervision tree with wxwidget there are two seperate supervisor. But why behaving like killing both apps in my case.

Any link or explanation would be appreciate.

Most Liked

LostKobrakai

LostKobrakai

As mentioned there is no supervision for or of applications. If the root process of an application terminates the application will terminate. There’s neither an attempt made to restart the application, nor to restart the root process (the pid returned from Application.start/2 is the root process).

What happens as a result of the application terminating depends on its restart type. If :permanent the whole vm will shut down, with :transient the same will happen only if the exit reason of the root process wasn’t :normal otherwise it behaves like :temporary, which means the application termination is reported, but nothing else happens. Application — Elixir v1.20.2

The default for your dependencies and all your apps in an umbrella is :permanent, but you can customize the type in the release settings.

Shoehorn builds on top of those things by defaulting all applications to :temporary unless explicitly mentioned as an :init application, making them permanent and ordering them to start as early as possible.

It also integrates with the application termination reporting to allow you to restart applications. I’d however strongly suggest to exhaust other solutions before going with that one.

tristan

tristan

Rebar3 Core Team

I think it is important to note that an umbrella is a project layout solution and unrelated to how the program actually runs.

adw632

adw632

By default if an OTP application crashes, the BEAM will exit. This means your application supervision tree has crashed or failed to start.

By default there is no restarting at the app level, and restart typically needs to be handled outside of the VM, however you can look at Shoehorn from the nerves project which provides app crash recovery within the beam using a different boot setup and an app crash handler module. It also allows you to specify the startup order which can prioritise starting certain apps so they are available sooner.

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement