aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-08-29 13:32:04 +0200
committerErlang/OTP <[email protected]>2018-08-29 13:32:04 +0200
commit2a6b8f266737ab05baf9d3001c3926996510e9c6 (patch)
tree0669a32b6625dcca69976d822b304fefc2e15d6e
parent53b1e77ea7be8d90d652521a2326046b5d95c3e2 (diff)
parent1d1a604d66806fb622d03a7c82f0316a5b15ba4b (diff)
downloadotp-2a6b8f266737ab05baf9d3001c3926996510e9c6.tar.gz
otp-2a6b8f266737ab05baf9d3001c3926996510e9c6.tar.bz2
otp-2a6b8f266737ab05baf9d3001c3926996510e9c6.zip
Merge branch 'rickard/fix-suspend-monitor-down/OTP-15237/ERL-704' into maint-21
* rickard/fix-suspend-monitor-down/OTP-15237/ERL-704: Fix incoming suspend monitor down
-rw-r--r--erts/emulator/beam/erl_proc_sig_queue.c2
-rw-r--r--erts/emulator/test/trace_SUITE.erl19
2 files changed, 18 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_proc_sig_queue.c b/erts/emulator/beam/erl_proc_sig_queue.c
index d6d22677e7..6af1236145 100644
--- a/erts/emulator/beam/erl_proc_sig_queue.c
+++ b/erts/emulator/beam/erl_proc_sig_queue.c
@@ -3146,8 +3146,8 @@ erts_proc_sig_handle_incoming(Process *c_p, erts_aint32_t *statep,
erts_monitor_tree_delete(&ERTS_P_MONITORS(c_p),
&mdp->origin);
omon = &mdp->origin;
+ remove_nm_sig(c_p, sig, next_nm_sig);
}
- remove_nm_sig(c_p, sig, next_nm_sig);
break;
default:
ERTS_INTERNAL_ERROR("invalid monitor type");
diff --git a/erts/emulator/test/trace_SUITE.erl b/erts/emulator/test/trace_SUITE.erl
index 979b3185a5..c2d5cd7023 100644
--- a/erts/emulator/test/trace_SUITE.erl
+++ b/erts/emulator/test/trace_SUITE.erl
@@ -39,7 +39,7 @@
system_monitor_large_heap_1/1, system_monitor_large_heap_2/1,
system_monitor_long_schedule/1,
bad_flag/1, trace_delivered/1, trap_exit_self_receive/1,
- trace_info_badarg/1]).
+ trace_info_badarg/1, erl_704/1]).
-include_lib("common_test/include/ct.hrl").
@@ -63,7 +63,7 @@ all() ->
system_monitor_long_gc_2, system_monitor_large_heap_1,
system_monitor_long_schedule,
system_monitor_large_heap_2, bad_flag, trace_delivered,
- trap_exit_self_receive, trace_info_badarg].
+ trap_exit_self_receive, trace_info_badarg, erl_704].
init_per_testcase(_Case, Config) ->
[{receiver,spawn(fun receiver/0)}|Config].
@@ -1739,6 +1739,21 @@ trace_info_badarg(Config) when is_list(Config) ->
catch erlang:trace_info({a,b,c},d),
ok.
+%% An incoming suspend monitor down wasn't handled
+%% correct when the local monitor half had been
+%% removed with an emulator crash as result.
+erl_704(Config) ->
+ erl_704_test(100).
+
+erl_704_test(0) ->
+ ok;
+erl_704_test(N) ->
+ P = spawn(fun () -> receive infinity -> ok end end),
+ erlang:suspend_process(P),
+ exit(P, kill),
+ (catch erlang:resume_process(P)),
+ erl_704_test(N-1).
+
drop_trace_until_down(Proc, Mon) ->
drop_trace_until_down(Proc, Mon, false, 0, 0).