aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2019-05-27 20:16:38 +0200
committerSverker Eriksson <[email protected]>2019-05-28 17:34:52 +0200
commit1b306c8a0755aca9de55fee2b02e38d17b696dfd (patch)
tree55d65b77a00dd86f3b95536b125d1c6f22c0f01b /lib/kernel
parenta0ae44f324576104760a63fe6cf63e0ca31756fc (diff)
downloadotp-1b306c8a0755aca9de55fee2b02e38d17b696dfd.tar.gz
otp-1b306c8a0755aca9de55fee2b02e38d17b696dfd.tar.bz2
otp-1b306c8a0755aca9de55fee2b02e38d17b696dfd.zip
erts: Fix bug in seq_trace:set_token(label,_)
If internal seq-trace tuple is on old heap an incorrect ref from old to new heap was made.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/seq_trace_SUITE.erl20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl
index ceb4e9cc49..7c1413287c 100644
--- a/lib/kernel/test/seq_trace_SUITE.erl
+++ b/lib/kernel/test/seq_trace_SUITE.erl
@@ -23,6 +23,7 @@
init_per_group/2,end_per_group/2,
init_per_testcase/2,end_per_testcase/2]).
-export([token_set_get/1, tracer_set_get/1, print/1,
+ old_heap_token/1,
send/1, distributed_send/1, recv/1, distributed_recv/1,
trace_exit/1, distributed_exit/1, call/1, port/1,
match_set_seq_token/1, gc_seq_token/1, label_capability_mismatch/1]).
@@ -46,6 +47,7 @@ suite() ->
all() ->
[token_set_get, tracer_set_get, print, send,
distributed_send, recv, distributed_recv, trace_exit,
+ old_heap_token,
distributed_exit, call, port, match_set_seq_token,
gc_seq_token, label_capability_mismatch].
@@ -531,6 +533,24 @@ get_port_message(Port) ->
end.
+%% OTP-15849 ERL-700
+%% Verify changing label on existing token when it resides on old heap.
+%% Bug caused faulty ref from old to new heap.
+old_heap_token(Config) when is_list(Config) ->
+ seq_trace:set_token(label, 1),
+ erlang:garbage_collect(self(), [{type, minor}]),
+ erlang:garbage_collect(self(), [{type, minor}]),
+ %% Now token tuple should be on old-heap.
+ %% Set a new non-literal label which should reside on new-heap.
+ NewLabel = {self(), "new label"},
+ 1 = seq_trace:set_token(label, NewLabel),
+
+ %% If bug, we now have a ref from old to new heap. Yet another minor gc
+ %% will make that a ref to deallocated memory.
+ erlang:garbage_collect(self(), [{type, minor}]),
+ {label,NewLabel} = seq_trace:get_token(label),
+ ok.
+
match_set_seq_token(doc) ->
["Tests that match spec function set_seq_token does not "