[erlang-questions] ETS-TRANSFER

Sverker Eriksson sverker.eriksson@REDACTED
Mon Nov 4 15:12:53 CET 2013

On 11/01/2013 03:18 PM, akonsu wrote:
> Hello,
> I am reading the code at https://github.com/DeadZen/etsgive that implements
> one of the ETS handling techniques mentioned in
> http://steve.vinoski.net/blog/2011/03/23/dont-lose-your-ets-tables/, and
> one thing (out of several) that I do not understand is this callback:
> https://github.com/DeadZen/etsgive/blob/master/src/etsgive_mgr.erl#L110.
> It handles ETS-TRANSFER message that the ETS table heir receives when the
> table owner terminates. Is this message received after the owner
> terminates? Is it guaranteed that the owner is dead by the time I receive
> this message? The code in the repo waits for a new owner to get started (
> https://github.com/DeadZen/etsgive/blob/master/src/etsgive_mgr.erl#L111).
> Is it possible for this function call to return the dying owner's Pid
> instead?

Yes, it looks like its possible to get the Pid of the dying process when 
doing whereis after receiving an ETS-TRANSFER message.

erlang:is_process_alive/1 will however return false for the dying process.

I would probably be better if we changes this in order to guarantee that 
the process has released all resources when the ETS-TRANSFER message 
arrives, as is guaranteed for monitor and link messages. It's not a 
trivial fix though.

/Sverker, Erlang/OTP

More information about the erlang-questions mailing list