<div dir="ltr">Hi,<div><br></div><div>I've use process_flag(trap_exit, true) in X:init() but still failed. X still died. mmm.. if i look closely to the error message, the erlang shell is also died</div><div><br></div><div><br></div><div>Thank you</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Pada tanggal Sen, 3 Jun 2019 pukul 02.53 Alin Popa <<a href="mailto:alin.popa@gmail.com">alin.popa@gmail.com</a>> menulis:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Looks like you've linked the Y process to the X process, therefore when Y exists it'll take down X as well.<div>What you could do is to make process X to trap exit:</div><div><br></div><div>```<br>process_flat(trap_exit, true)</div><div>```</div><div><br></div><div>Usually you could add that within the `init` function of process X.</div><div>When you do that, if any linked process exists, it'll send a message to the process X instead of taking it down.</div><div><br></div><div>Hope that helps,</div><div>Alin</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jun 2, 2019 at 7:01 PM I Gusti Ngurah Oka Prinarjaya <<a href="mailto:okaprinarjaya@gmail.com" target="_blank">okaprinarjaya@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi, <div><br></div><div>I create two gen_server. Let's say X gen_server, and Y gen_server.</div><div><br></div><div>X gen_server do monitoring using erlang:monitor/2 to Y gen_server.</div><div>When i do Y:stop(). X gen_server also died. </div><div><br></div><div>I want to <b>X gen_server still alive</b> even monitored Y gen_server is died. </div><div><br></div><div>This is X gen_server <a href="https://pastebin.com/G2xDNxMf" target="_blank">https://pastebin.com/G2xDNxMf</a><br>This is Y gen_server <a href="https://pastebin.com/hWUfUPmn" target="_blank">https://pastebin.com/hWUfUPmn</a></div><div><br></div><div>This is the result when i run my code </div><div><br></div><div>





<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">1> oka_oprek_agensrv:start_link().</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">{ok,<0.86.0>}</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">2> oka_oprek_agensrv:start_bgensrv().</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">{ok,start_bgensrv,</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space">    </span>{<0.84.0>,#Ref<0.1555235413.310640643.180158>}}</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">3> oka_oprek_agensrv:hello().</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">{ok,hello,{<0.84.0>,#Ref<0.1555235413.310640643.180166>}}</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">4> oka_oprek_bgensrv:hello().</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">{ok,hello_from_b,</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space">    </span>{<0.84.0>,#Ref<0.1555235413.310640643.180173>}}</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">5> oka_oprek_bgensrv:stop().</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">Monitored process died. Ref=#Ref<0.1555235413.310640643.180161>, Pid=<0.88.0></font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">** exception exit: {normal,{gen_server,call,[bgensrv,stop]}}</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space">     </span>in function<span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space">  </span>gen_server:call/2 (gen_server.erl, line 215)</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">6> oka_oprek_agensrv:hello().</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">** exception exit: {noproc,{gen_server,call,[agensrv,hello]}}</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space">     </span>in function<span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space">  </span>gen_server:call/2 (gen_server.erl, line 215)</font></span></p>
<p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><font face="courier new, monospace">7><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space"> </span></font></span></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-Apple-converted-space"><br></span></span></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">Please enlightenment </font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif">Thank you </font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p><p class="gmail-m_6594531225226936966gmail-m_-2734415415949723356gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;color:rgb(0,0,0)"><font face="arial, sans-serif"><br></font></p></div></div>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div>
</blockquote></div>