Regarding clearing gen_server state

Edward Wang <>
Fri Mar 11 15:24:50 CET 2011


FYI. This is a nice read and clarify the question for me:

"On Erlang, State and Crashes" https://gist.github.com/85007bfc4f7b8c75ad8e

On Sun, Feb 20, 2011 at 4:40 AM, Edward Wang <> wrote:

> Hi,
>
> In Erlang, it is quite ubiquitous to use state of dynamically spawned
> gen_server to represent entities in problem domain. These gen_servers can
> trap exit signal and do housekeeping when gracefully terminating. If some of
> them crash, a monitoring process can take care of housekeeping for them.
> But, the problem is most likely the monitoring process doesn't have enough
> data to do so. No shared state, remember?
>
> So, I end up with two copy of the same data, one in gen_server's state, one
> in ets table. Not only I need to keep them in sync, but also it *is* shared
> data to some extent.
>
> How can I do it differently?
>
> Regards,
> Edward
>


More information about the erlang-questions mailing list