[erlang-questions] Lost messages

Mazen Harake mazen.harake@REDACTED
Mon Jul 27 16:46:47 CEST 2009

You are absolutely right, I know this, but the point is not to solve the
race condition in the ETS table, it is to clean it up. (There should be
a way to clean it up I guess). In the end it is impossible to solve this
problem since there is no way in Erlang to verify that the message was
received without sending one back and if so, how long do you wait for a
reply before you time out and does that mean that the process is dead if
you time out? etc...

The simple reasoning I use in this case is; If there are too many things
I'm trying to control to make it work then perhaps my way of making it
work is wrong from the beginning. Usually when things become too complex
you are generally doing it wrong and too much complexity is an alarm
clock to wake you up and rethink, that is what I feel everytime I
encounter something like this anyway.

This is why I was curious about what the actual problem is more then the
solution to a perhaps imaginary problem.


Attila Rajmund Nohl wrote:
> The linking itself does not avoid the problem, it just makes it occur
> less often (thus harder to reproduce in case it leads to a bug). If
> the message is sent after the process died, but before the 'EXIT'
> message is received (due to linking), it's still a problem.
> By the way, an interesting race condition I've seen a couple of months ago:
> process A links to process B, which in turn links to process C.
> Process A also monitors process C and none of the processes trap
> exits. What happens if process C gets (brutally) killed? The code I
> was fixing was based on the assumption that process A receives the
> {'DOWN', ...} message (because of the monitor), but in real life
> process A was killed before the {'DOWN',...} message was received,
> leading to a bug...
> 2009/7/27, Mazen Harake <mazen.harake@REDACTED>:
>> Hi George,
>> I'm curious in which situation you are considering this a problem. Can
>> you please elaborate?
>> Also, if you can, you should somehow link to the processes and clean
>> them up from the ETS table to avoid this problem.
>> Regards,
>> /Mazen
>> George Xu wrote:
>>> It is said that send message is safe. But I count the problem of lost
>>> message.
>>> The situation is like this:
>>> 1. I use a ets table to store all process to be communicated.
>>> 2. But those process will terminated with some cases.
>>> 3. In case of one process is terminated but still not reflected to the ets
>>> table, send message to this process happened sametimes. It seems the
>>> message is send, but it can not reach since the process is termiated and
>>> the message is lost.
>>> Anyone knows how to solve this problem?
>>> ━━━━━━━━━━━━━━━━━━━━━━━━━━
>>> 徐翔 George Xu
>>> Mobile Internet Service Lab, Lonovo Corp. Research China
>>> Tel:86-10-58866181
>>> E-mail:xuxiang1@REDACTED
>>> No.6 Shang Di West Road, Haidian District,
>>> Beijing, 100085
>>> P.R.China
>> ________________________________________________________________
>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>> erlang-questions (at) erlang.org

More information about the erlang-questions mailing list