[erlang-questions] inet:getstat on non-socket crashes the VM?

Rickard Green rickard@REDACTED
Mon Jun 25 02:42:09 CEST 2018


On Fri, Jun 22, 2018 at 1:53 PM, Bekes, Andras G <
Andras.Bekes@REDACTED> wrote:
>
> Hi Erlangers,
>
>
>
> I noticed that calling inet:getstat/1 is a dangerous operation, as it can
kill the whole VM if used inappropriately.
>
>
>
> It is easy to reproduce:
>
>
>
> Eshell V9.3  (abort with ^G)
>
> 1> application:start(sasl).
>
> ok
>
> 2> [inet:getstat(X) || X<-erlang:ports()].
>
> Failed to write to erl_child_setup: 9
>
> Crash dump is being written to: erl_crash.dump...done
>
>
>
> Without sasl, it doesn’t kill the VM, but the terminal gets into a faulty
state and further work is not possible.
>
> I know calling it on a non-socket is an erroneous action, but crashing
the VM doesn’t seem to be the most appropriate consequence.
>
> What do you think?
>
>
>
> Regards,
>
>
>
> Andras G. Bekes
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>

Broadcasting random stuff around is dangerous. Different ports (and
processes) have different protocols that they expect to be used. A message
that means something for one port may mean something completely different
for another port.

Regards,
Rickard
--
Rickard Green, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180625/41ebd2f1/attachment.htm>


More information about the erlang-questions mailing list