[erlang-bugs] seq_trace broken for a while?

Scott Lystig Fritchie fritchie@REDACTED
Sun Feb 10 23:16:50 CET 2008


Greetings ... I haven't used seq_trace enough to know if it has ever
been in a not-broken state, but it seems to be broken in both R11B-5 and
R12B-1.

In the attached piece of doodling, tracefoo:demo5() and tracefoo:demo1()
give a couple of examples of what's going on.  (The other demo*
functions are attempts to find a pattern in the haystack.)

In demo5(), I was expecting a 'send' and 'receive' trace msgs for the
1st & 3rd hops in the message's 3-hop page.  In demo1(), I was expecting
to see 'send' and 'receive' trace msgs for each of the round-trip
messages.

Any chance I'm not understanding the 'seq_trace' reference manual?

-Scott

--- snip --- snip --- snip --- snip --- snip --- 

-module(tracefoo).

-compile(export_all).

setup() ->
    seq_trace:set_token(send,true),
    seq_trace:set_token('receive',true),
    seq_trace:set_token(timestamp, true),
    seq_trace:set_token(print,true),
    ok.
    
little_child() ->
    receive {big_parent, Pid} ->
	    Pid ! {little_child_reply, from, self()}
    end.
    
%%
%% R11B-5 and R12B-1:
%% No send or receive seq_trace messages on 1st & 3rd message hops!
%% But all print seq_trace messages are printed as expected.
%% Seq_trace messages related to the io:format() are all (?) present?
%%

demo5() ->
    ServerA = spawn(fun server/0),
    ServerB = spawn(fun server/0),
    seq_trace:set_system_tracer(self()),
    timer:sleep(300),				% no effect...
    setup(),
    timer:sleep(300),				% no effect...
    Token = seq_trace:get_token(), erlang:display({token_is, Token}),
    ServerA ! {forward_to, ServerB, {big_parent, self()}},
    timer:sleep(300),
    receive X when element(1, X) == little_child_reply ->
	    seq_trace:print({i, am, self(), got, my, ultimate, reply}),
	    io:format("Got X = ~p\n", [X])
    end,
    timer:sleep(300),
    seq_trace:set_system_tracer(false),
    shell_default:flush().

%%
%% R11B-5 and R12B-1:
%% No send or receive seq_trace messages received at all!
%%

demo1() ->
    spawn(fun() ->
		  seq_trace:set_system_tracer(self()),
		  setup(),
		  timer:sleep(300),		% No effect...
		  C1 = spawn(fun little_child/0),
		  C2 = spawn(fun little_child/0),
		  C1 ! {big_parent, self()},
		  C2 ! {big_parent, self()},
		  timer:sleep(300),
		  seq_trace:set_system_tracer(false),
		  shell_default:flush()
	  end),
    timer:sleep(2*1000).

%% Variations on the theme....

demo2() ->
    seq_trace:set_system_tracer(self()),
    spawn(fun() ->
		  setup(),
		  C1 = spawn(fun little_child/0),
		  C2 = spawn(fun little_child/0),
		  C1 ! {big_parent, self()},
		  C2 ! {big_parent, self()},
		  timer:sleep(1*1000),
		  ok
	  end),
    timer:sleep(2*1000),
    seq_trace:set_system_tracer(false),
    shell_default:flush().

demo3() ->
    seq_trace:set_system_tracer(self()),
    setup(),
    spawn(fun() ->
		  C1 = spawn(fun little_child/0),
		  C2 = spawn(fun little_child/0),
		  C1 ! {big_parent, self()},
		  C2 ! {big_parent, self()},
		  timer:sleep(1*1000),
		  ok
	  end),
    timer:sleep(2*1000),
    seq_trace:set_system_tracer(false),
    shell_default:flush().

demo4() ->
    seq_trace:set_system_tracer(self()),
    setup(),
    spawn(fun() ->
		  setup(),
		  C1 = spawn(fun little_child/0),
		  C2 = spawn(fun little_child/0),
		  timer:sleep(100),
		  setup(),
		  C1 ! {big_parent, self()},
		  C2 ! {big_parent, self()},
		  seq_trace:set_token(label, 77),
		  timer:sleep(1*1000),
		  ok
	  end),
    timer:sleep(2*1000),
    seq_trace:set_system_tracer(false),
    shell_default:flush().

server() ->
    receive
	{forward_to, NewPid, Msg} ->
	    seq_trace:print({i, am, self(), forwarding, to, NewPid}),
	    NewPid ! Msg;
	{big_parent, Pid} ->
	    seq_trace:print({i, am, self(), replying, to, Pid}),
	    Pid ! {little_child_reply, from, self()}
    end.

demo6() ->
    seq_trace:set_system_tracer(self()),
    setup(),
    ServerA = spawn(fun server/0),
    ServerB = spawn(fun server/0),
    ServerA ! {forward_to, ServerB, {big_parent, self()}},
    timer:sleep(100),
    seq_trace:set_system_tracer(false),
    shell_default:flush().




More information about the erlang-bugs mailing list