diff options
author | Lukas Larsson <[email protected]> | 2016-10-04 10:24:56 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-10-04 11:01:33 +0200 |
commit | b001b56e061454f3175d9d9a99e2efb945a696b9 (patch) | |
tree | 2cd036b6c45efe1fc67cf64b33a818f330840ca0 /erts/emulator/test/trace_SUITE.erl | |
parent | 3f3f25b23379b1afb15cc97462cf5d385690f5a0 (diff) | |
download | otp-b001b56e061454f3175d9d9a99e2efb945a696b9.tar.gz otp-b001b56e061454f3175d9d9a99e2efb945a696b9.tar.bz2 otp-b001b56e061454f3175d9d9a99e2efb945a696b9.zip |
erts: Do tracer liveness check on current tracer
This fixes a fault introduced in 19.0 where an invalid
tracer would block setting of a new tracer on a process.
Diffstat (limited to 'erts/emulator/test/trace_SUITE.erl')
-rw-r--r-- | erts/emulator/test/trace_SUITE.erl | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/erts/emulator/test/trace_SUITE.erl b/erts/emulator/test/trace_SUITE.erl index da6a6bdea4..f846b0f4b9 100644 --- a/erts/emulator/test/trace_SUITE.erl +++ b/erts/emulator/test/trace_SUITE.erl @@ -30,7 +30,7 @@ procs_trace/1, dist_procs_trace/1, procs_new_trace/1, suspend/1, mutual_suspend/1, suspend_exit/1, suspender_exit/1, suspend_system_limit/1, suspend_opts/1, suspend_waiting/1, - new_clear/1, existing_clear/1, + new_clear/1, existing_clear/1, tracer_die/1, set_on_spawn/1, set_on_first_spawn/1, cpu_timestamp/1, set_on_link/1, set_on_first_link/1, system_monitor_args/1, more_system_monitor_args/1, @@ -54,7 +54,7 @@ all() -> send_trace, procs_trace, dist_procs_trace, suspend, mutual_suspend, suspend_exit, suspender_exit, suspend_system_limit, suspend_opts, suspend_waiting, - new_clear, existing_clear, set_on_spawn, + new_clear, existing_clear, tracer_die, set_on_spawn, set_on_first_spawn, set_on_link, set_on_first_link, system_monitor_args, more_system_monitor_args, system_monitor_long_gc_1, @@ -1636,6 +1636,34 @@ existing_clear(Config) when is_list(Config) -> ok. +%% Test that erlang:trace/3 can be called on processes where the +%% tracer has died. OTP-13928 +tracer_die(Config) when is_list(Config) -> + Proc = spawn(fun receiver/0), + + Tracer = spawn(fun receiver/0), + timer:sleep(1), + N = erlang:trace(existing, true, [send, {tracer, Tracer}]), + {flags, [send]} = erlang:trace_info(Proc, flags), + {tracer, Tracer} = erlang:trace_info(Proc, tracer), + exit(Tracer, die), + + Tracer2 = spawn(fun receiver/0), + timer:sleep(1), + N = erlang:trace(existing, true, [send, {tracer, Tracer2}]), + {flags, [send]} = erlang:trace_info(Proc, flags), + {tracer, Tracer2} = erlang:trace_info(Proc, tracer), + exit(Tracer2, die), + + Tracer3 = spawn(fun receiver/0), + timer:sleep(1), + 1 = erlang:trace(Proc, true, [send, {tracer, Tracer3}]), + {flags, [send]} = erlang:trace_info(Proc, flags), + {tracer, Tracer3} = erlang:trace_info(Proc, tracer), + exit(Tracer3, die), + + ok. + %% Test that an invalid flag cause badarg bad_flag(Config) when is_list(Config) -> %% A bad flag could deadlock the SMP emulator in erts-5.5 |