summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSverker Eriksson <sverker@erlang.org>2022-02-22 13:09:57 +0100
committerSverker Eriksson <sverker@erlang.org>2022-02-22 13:22:43 +0100
commit7fd016388ba8facc563e74dc7b9792fafa244fe6 (patch)
treea3b654c111def8e69e84509f7bd8f41d0ce62952
parent60497f1b78d9fc7f02e16b8dba035548abbf4e9f (diff)
downloaderlang-7fd016388ba8facc563e74dc7b9792fafa244fe6.tar.gz
erts: Fix erlang:is_alive/0 to not call net_kernel
Module erlang is preloaded and not allowed to call non-preloaded modules like net_kernel. Have been seen to cause spinning beam.smp when piped STDIN and STDOUT. Bug introduced by c4d92b48e27aa8ed550d02e3511e2bc288847579 and included in OTP-25.0-rc1.
-rw-r--r--erts/preloaded/ebin/erlang.beambin131440 -> 131496 bytes
-rw-r--r--erts/preloaded/src/erlang.erl2
-rw-r--r--lib/kernel/src/net_kernel.erl4
3 files changed, 1 insertions, 5 deletions
diff --git a/erts/preloaded/ebin/erlang.beam b/erts/preloaded/ebin/erlang.beam
index 73a8f0da24..02d219d794 100644
--- a/erts/preloaded/ebin/erlang.beam
+++ b/erts/preloaded/ebin/erlang.beam
Binary files differ
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl
index af6f1e1946..c2fe2a41c2 100644
--- a/erts/preloaded/src/erlang.erl
+++ b/erts/preloaded/src/erlang.erl
@@ -1276,7 +1276,7 @@ iolist_to_iovec(_IoListOrBinary) ->
%% is_alive/0
-spec is_alive() -> boolean().
is_alive() ->
- net_kernel:is_alive().
+ erlang:whereis(net_kernel) =/= undefined.
%% is_builtin/3
-spec erlang:is_builtin(Module, Function, Arity) -> boolean() when
diff --git a/lib/kernel/src/net_kernel.erl b/lib/kernel/src/net_kernel.erl
index 8d172dbccd..7b15e45912 100644
--- a/lib/kernel/src/net_kernel.erl
+++ b/lib/kernel/src/net_kernel.erl
@@ -70,7 +70,6 @@
nodename/0,
protocol_childspecs/0,
epmd_module/0,
- is_alive/0,
get_state/0,
dist_listen/0]).
@@ -192,9 +191,6 @@ longnames() -> request(longnames).
nodename() -> request(nodename).
-is_alive() ->
- whereis(net_kernel) =/= undefined.
-
get_state() ->
case whereis(net_kernel) of
undefined ->