[erlang-questions] Erlang shell crashes
Kostis Sagonas
kostis@REDACTED
Mon Oct 30 11:57:59 CET 2006
Jay Nelson wrote:
>
> Also verify that for every message send (i.e., Pid ! Msg) there is somewhere
> that you receive the message. If you are using receive patterns that do not
> match up, messages will accumulate that can never be removed.
In the context of the Dialyzer tool, we want for a long time now to
extend its analysis so that it is also able to detect concurrency bugs
like this one -- I have even written a research proposal to a Swedish
funding agency that, if funded, promises to do exactly this type of
static analysis.
Although the analysis needed is not trivial, we (think we) know exactly
how to do this, but doing it never made it high on our priority list
partly due to lack of "real" test cases where such defect detection is
needed. We would very much appreciate if Erlang users send us code
which suffers exactly from this type of problem. We promise we will not
use this code for any other purposes.
> You should also use a catch all message to remove any messages you were not expecting:
>
> receive
> {From, expected_msg, Data} ->
> do_something(Data);
> AnyUnexpectedMsg ->
> log_and_skip_handling(AnyUnexpectedMsg)
> end.
Doing this, of course solves this problem by potentially hiding it under
the carpet, right?
Kostis
More information about the erlang-questions
mailing list