[erlang-questions] supervisors, gen_server:terminate/2, and trap_exit

Imants Cekusins imantc@REDACTED
Thu Mar 12 15:07:21 CET 2015

so, to ensure gs terminate is called,

otp:start_link | erlang:link    should be followed by
erlang:process_flag(trap_exit, true)

can we say that?

> most of the questions you ask come from not properly
understanding the signals in Erlang, and how trapping exits affects
them. I recommend reading possibly
http://learnyousomeerlang.com/errors-and-processes for this.

well you see I link only from supervisors via otp:start_link, spawn
non-otp stuff and otp:start otp children from non-sups, relying on
timeouts to tell that something went wrong. crashes do not really
cause havoc in this scheme so I did not pay much attention to linking.

I assumed that OTP links traps exits by default. Thank you for clarifying this!

Thank you very much Fred.

More information about the erlang-questions mailing list