[erlang-questions] excute code in the supervisor when a child crashes?

Pablo Platt pablo.platt@REDACTED
Mon Oct 19 23:08:16 CEST 2009


Mihai,
As you suggested I'm reading about gproc from:
http://svn.ulf.wiger.net/gproc/branches/experimental-0906/gproc/doc/erlang07-wiger.pdf
http://rklophaus.com/blog/2009/9/16/gproc-erlang-global-process-registry.html

Is this the version I should use? http://svn.ulf.wiger.net/gproc/branches/experimental-0906/gproc/ 

I've read that some patches needed for the kernel and about a dependence on gen_leader.
Is anything needed except compiling the grpoc app and putting it in the erlang path?

Thanks





________________________________
From: Mihai Balea <mihai@REDACTED>
To: Pablo Platt <pablo.platt@REDACTED>
Cc: erlang-questions Questions <erlang-questions@REDACTED>
Sent: Mon, October 19, 2009 10:21:28 PM
Subject: Re: [erlang-questions] excute code in the supervisor when a child  crashes?


On Oct 19, 2009, at 1:39 PM, Pablo Platt wrote:

> Sounds like a good solution.
> I'll create a gen_server that will call supervisor:start_child
> then it'll monitor the pid and store it in an ETS so other clients will be able to send messags to the child.
> If the child exists or crashes the monitoring gen_server will delete the ETS record of this process.
> 
> The complexity is if the monitoring process dies.
> In this case it needs to scan the whole ETS table, re-monitor all live process and delete records of all the dead processes.


The problem with that is if the ETS table is owned by the monitoring process, it will go down with it.

You might want to try an already existing solution, such as UlfWiger'sproc/grpoc. It's basically the same idea, just that the code has already been in use for a while, so it should be relatively solid.
In addition, gproc works in a clustered environment, if your requirements include that.

Mihai


________________________________________________________________
erlang-questions mailing list. See http://www.erlang.org/faq.html
erlang-questions (at) erlang.org


      


More information about the erlang-questions mailing list