[erlang-questions] Regarding clearing gen_server state

Edward Wang yujiangw@REDACTED
Sun Feb 20 04:59:42 CET 2011

Steve and Bernard,

Thanks for your reply, that's helpful. I should have been more specific.

I'm working on a UPnP implementation for Erlang recently. After a UPnP
service in LAN being discovered, one gen_server Q is spawned to represent
it. Q may tell UPnP service to subscribe to a HTTP callback Url. When
terminating, unsubscribe it. If Q crashes, ideally, P should do the

Only Q knows details about UPnP service. It holds that information in its
state. There's also a ets table that has all Qs' pid. Other process can
query the table and asks Q to do certain operation. I find such a design
conceptually simple.

Except for one problem. If Q crashes, all information about that UPnP
service is gone. P can't do unsubscription for Q. So eventually, the ets
table that has Qs' pid becomes to have all information about UPnP services.
It is less elegant and, worse, duplication of the same data.

Alternative solutions?

On Feb 20, 2011 7:28 AM, "Bernard Duggan" <bernie@REDACTED> wrote:

More information about the erlang-questions mailing list