File 0752-erts-Try-to-make-dump_SUITE-abort_signal-more-stable.patch of Package erlang
From 5aae428d1ecfb3046cd2c1ca12bcbfea25d9f139 Mon Sep 17 00:00:00 2001
From: Lukas Larsson <lukas@erlang.org>
Date: Thu, 25 Nov 2021 13:03:55 +0100
Subject: [PATCH 07/11] erts: Try to make dump_SUITE:abort_signal more stable
We do this by using internal state sleeping instead of
spinning.
The idea is that it will be more likely for a process
to be scheduled in when the abort comes if they sleep
in internal state.
An effect of this was that the system became much less
responsive, so we make it so that the number of dist
messages are limited and also bind all actions done to
seperate schedulers.
---
erts/emulator/test/dump_SUITE.erl | 41 ++++++++++++++++++++-----------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/erts/emulator/test/dump_SUITE.erl b/erts/emulator/test/dump_SUITE.erl
index 31a80434c7..08e2e682b8 100644
--- a/erts/emulator/test/dump_SUITE.erl
+++ b/erts/emulator/test/dump_SUITE.erl
@@ -68,19 +68,29 @@ signal_abort(Config) ->
{ok, Node} = start_node(Config),
- SO = rpc:call(Node, erlang, system_info, [schedulers_online]),
-
- Iter = lists:seq(0, 5),
-
- [spawn_opt(Node, ?MODULE, load, [self()], [{scheduler, (I rem SO) + 1}])
- || I <- Iter],
-
- %% Make sure that each process is started
- [receive ok -> ok end || _ <- Iter],
- timer:sleep(500),
-
- true = rpc:call(Node, os, putenv, ["ERL_CRASH_DUMP",Dump]),
- rpc:call(Node, erlang, halt, ["dump"]),
+ false = rpc:call(Node, erts_debug, set_internal_state,
+ [available_internal_state, true]),
+
+ Iter = lists:seq(2, 3),
+
+ spawn_opt(Node,
+ fun() ->
+ os:putenv("ERL_CRASH_DUMP", Dump),
+ code:ensure_loaded(timer),
+
+ %% We spread the load on all schedulers except scheduler 1
+ [spawn_opt(?MODULE, load, [self()], [{scheduler, I}])
+ || I <- Iter],
+
+ %% Make sure that each process is started
+ [receive ok -> ok end || _ <- Iter],
+ timer:sleep(500),
+ erlang:halt("dump")
+ end,
+ [{scheduler,1},{priority,high}, monitor]),
+ receive
+ M -> ct:pal("~p",[M])
+ end,
{ok, Bin} = get_dump_when_done(Dump),
@@ -98,7 +108,8 @@ load(Parent) ->
Parent ! ok,
load().
load() ->
- lists:seq(1,10000),
+ %% We generate load by sleeping
+ erts_debug:set_internal_state(sleep, 10),
load().
@@ -214,7 +225,7 @@ get_dump_when_done(Dump) ->
get_dump_when_done(Dump, Sz) ->
timer:sleep(1000),
case file:read_file_info(Dump) of
- {ok, #file_info{ size = Sz }} ->
+ {ok, #file_info{ size = Sz }} when Sz > 1000 ->
{ok, Bin} = file:read_file(Dump),
ct:log("~s",[Bin]),
{ok, Bin};
--
2.31.1