Regarding clearing gen_server state

Edward Wang <>
Sat Feb 19 21:40:12 CET 2011


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