[erlang-questions] X gen_server also died when monitored Y gen_server died. why?

I Gusti Ngurah Oka Prinarjaya okaprinarjaya@REDACTED
Sun Jun 2 20:00:56 CEST 2019


I create two gen_server. Let's say X gen_server, and Y gen_server.

X gen_server do monitoring using erlang:monitor/2 to Y gen_server.
When i do Y:stop(). X gen_server also died.

I want to *X gen_server still alive* even monitored Y gen_server is died.

This is X gen_server https://pastebin.com/G2xDNxMf
This is Y gen_server https://pastebin.com/hWUfUPmn

This is the result when i run my code

1> oka_oprek_agensrv:start_link().


2> oka_oprek_agensrv:start_bgensrv().



3> oka_oprek_agensrv:hello().


4> oka_oprek_bgensrv:hello().



5> oka_oprek_bgensrv:stop().

Monitored process died. Ref=#Ref<0.1555235413.310640643.180161>,

** exception exit: {normal,{gen_server,call,[bgensrv,stop]}}

     in function  gen_server:call/2 (gen_server.erl, line 215)

6> oka_oprek_agensrv:hello().

** exception exit: {noproc,{gen_server,call,[agensrv,hello]}}

     in function  gen_server:call/2 (gen_server.erl, line 215)


Please enlightenment

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190603/3200f975/attachment.htm>

More information about the erlang-questions mailing list