aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2018-06-20 10:42:20 +0200
committerLukas Larsson <[email protected]>2018-08-03 09:47:51 +0200
commitd383549b6e9d9b5e06f23226a61564264204db51 (patch)
tree938462b708ac6442bb0dda7b99815505503a4d2a /lib/kernel
parentc33d4c7539a1681cfbc024d8637e204c0a05fd1a (diff)
downloadotp-d383549b6e9d9b5e06f23226a61564264204db51.tar.gz
otp-d383549b6e9d9b5e06f23226a61564264204db51.tar.bz2
otp-d383549b6e9d9b5e06f23226a61564264204db51.zip
erts: Fix seq_trace to not clear token for system messages
A lot of erts internal messages used behind APIs to create non-blocking calls, e.g. port_command, would cause the seq_trace token to be cleared from the caller when it should not. This commit fixes that and adds asserts that makes sure that all messages sent have to correct token set. Fixes: ERL-602
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/test/seq_trace_SUITE.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/kernel/test/seq_trace_SUITE.erl b/lib/kernel/test/seq_trace_SUITE.erl
index ceb4e9cc49..cf4bf11328 100644
--- a/lib/kernel/test/seq_trace_SUITE.erl
+++ b/lib/kernel/test/seq_trace_SUITE.erl
@@ -783,6 +783,24 @@ do_shrink(N) ->
erlang:garbage_collect(),
do_shrink(N-1).
+%% Test that messages from a port does not clear the token
+port_clean_token(Config) when is_list(Config) ->
+ seq_trace:reset_trace(),
+ Label = make_ref(),
+ seq_trace:set_token(label, Label),
+ {label,Label} = seq_trace:get_token(label),
+
+ %% Create a port and get messages from it
+ %% We use os:cmd as a convenience as it does
+ %% open_port, port_command, port_close and receives replies.
+ %% Maybe it is not ideal to rely on the internal implementation
+ %% of os:cmd but it will have to do.
+ os:cmd("ls"),
+
+ %% Make sure that the seq_trace token is still there
+ {label,Label} = seq_trace:get_token(label),
+
+ ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%