[erlang-questions] Poll: How do you handle spurious messages?
Wed Aug 6 17:38:44 CEST 2014
# Peer Stritzinger 2014-08-06:
> I'm interested in how you deal with spurious messages to your servers i.e.
FWIW this (processes sending messages to the wrong place) was never a problem
in real life as far as my memory serves. One would handle unexpected messages
as a general safety precaution, and one would imagine such code could come in
handy during code upgrades (where after all various internal protocols could
be inconsistent over limited period of time), but that's that.
> ... your important messages here ...
> Any -> ??? % we don't want crud to acrete in the mailbox
> Or in gen_server speak: what goes into your catchall
> handle_info(_Info, State) -> ???
Stylistic detail: in both cases I'd go with "_", not "Any" or "_Info".
Because why bother putting a name on irrelevant piece of information,
and why waste reader's time with it?
> Do you:
> 1. log the messages
> 1a.) as info
> 1b.) as warning
> 1c.) as error
> 2. count them e.g. with folsom or similar -> then what do you do
> with the counts?
> 3. Ignore them without trace?
> 4. Crash the server (gasp)?
> Did I forget something?
Ignore them without a trace. You can always use native tracing
facilities, or temporarily put in a patch that does 1/2, to aid
in particular bughunting situations.
In more specific cases 1/2/4 is adequate, but usually that wouldn't
be a wildcard "_" match -- ie. if a MAP state machine received
unexpected TCAP event I sure want a detailed audit log about it
(probably followed by dialogue teardown and process exit cause
I just don't know what else to do), but I still don't care if
somebody decides to send me absolute generic rubbish (it's most
likely them being broken, not me, so why should I deal with it?)
More information about the erlang-questions