[erlang-questions] Issue with process monitor
Sat Jun 17 22:30:18 CEST 2017
You are right! Been away from Erlang for a while and I forgot about the
fact that start_link will run from the supervisor process.
Added re_add_monitors_if_crashed() into init/1 function and it runs fine
Thank you for your quick help!
On Sun, Jun 18, 2017 at 1:45 AM, Felipe Ripoll Gisbert <ferigis@REDACTED>
> Hi Vimal,
> I took I quick look on your code and maybe I am wrong but I see this:
> You are calling the method re_add_monitors_if_crashed() from
> myapp_procmon:start_link/0. This function is called by the supervisor
> process, for this reason it is attaching the all the monitors to the
> You must call that re_add_monitors_if_crashed from the myapp_procmon
> process, for example in the init/1 function.
> 2017-06-17 12:48 GMT-06:00 Vimal Kumar <vimal7370@REDACTED>:
>> Hello List,
>> I am writing an Erlang application in which the main supervisor spawns a
>> child process (let's call it 'Process Monitor' process) which in turn
>> monitors the children of another simple-one-for-one supervisor. What I
>> notice is, if I deliberately kill this 'Process Monitor', all the monitors
>> it had will automatically attach to the main supervisor (even though the
>> main supervisor will have no idea how to handle those child processes DOWN
>> messages if they arrive later, isn't it??). Is this normal and by design?
>> Also, since the 'Process Monitor' process is part of the supervision
>> tree, it restarts and I coded it in such a way to try to monitor those
>> child processes again. Calling erlang:monitor/2 returns the MonitorRef but
>> it does not seem to work.
>> I have made a very small app to show the problem. The code and output is
>> available at https://github.com/vimal7370/myapp and it would be great if
>> someone can take a quick look at the code, or clone and run it and guide me
>> on what I am doing wrong.
>> Thank you!
>> erlang-questions mailing list
> *Felipe Ripoll Gisbert*
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions