Skip to content

Commit

Permalink
Merge branch 'lukas/kernel/fix-group-history-startup-deadlock/OTP-192…
Browse files Browse the repository at this point in the history
…05' into maint-26

* lukas/kernel/fix-group-history-startup-deadlock/OTP-19205:
  kernel: Don't load group history when in noshell mode
  • Loading branch information
Erlang/OTP committed Sep 4, 2024
2 parents 80daedd + ec91a1f commit 2edc283
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
11 changes: 10 additions & 1 deletion lib/kernel/src/group.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ server(Ancestors, Drv, Shell, Options) ->
process_flag(trap_exit, true),
_ = [put('$ancestors', Ancestors) || Shell =/= {}],
edlin:init(),
put(line_buffer, proplists:get_value(line_buffer, Options, group_history:load())),
put(read_mode, list),
put(user_drv, Drv),
ExpandFun = normalize_expand_fun(Options, fun edlin_expand:expand/2),
Expand All @@ -57,6 +56,16 @@ server(Ancestors, Drv, Shell, Options) ->
put(dumb, Dumb),
put(expand_below, proplists:get_value(expand_below, Options, true)),

DefaultGroupHistory =
case not get(echo) of
true ->
[];
false ->
group_history:load()
end,

put(line_buffer, proplists:get_value(line_buffer, Options, DefaultGroupHistory)),

server_loop(Drv, start_shell(Shell), []).

whereis_shell() ->
Expand Down
16 changes: 14 additions & 2 deletions lib/kernel/test/init_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

-export([get_arguments/1, get_argument/1, boot_var/1, restart/1,
many_restarts/0, many_restarts/1, restart_with_mode/1,
get_plain_arguments/1,
get_plain_arguments/1, init_group_history_deadlock/1,
reboot/1, stop_status/1, stop/1, get_status/1, script_id/1,
dot_erlang/1, unknown_module/1,
find_system_processes/0]).
Expand All @@ -47,7 +47,8 @@ suite() ->
all() ->
[get_arguments, get_argument, boot_var,
many_restarts, restart_with_mode,
get_plain_arguments, restart, stop_status, get_status, script_id,
get_plain_arguments, init_group_history_deadlock,
restart, stop_status, get_status, script_id,
dot_erlang, unknown_module, {group, boot}].

groups() ->
Expand Down Expand Up @@ -223,6 +224,17 @@ get_plain_arguments(Config) when is_list(Config) ->
ok.


init_group_history_deadlock(_Config) ->
Output = os:cmd(ct:get_progname() ++ " -noshell -eval \"logger:warning(\\\"testing\\\")\" "
"-inets services crashme -eval \"application:start(inets, permanent).\" "),

io:format("Got output: ~ts~n",[Output]),

case string:find(Output, "removed_failing_handler") of
nomatch -> ok;
_ -> ct:fail("Found unexpected printout in log")
end.

%% ------------------------------------------------
%% Use -boot_var flag to set $TEST_VAR in boot script.
%% ------------------------------------------------
Expand Down

0 comments on commit 2edc283

Please sign in to comment.