Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't enable 'receive' trace for specific process using meta tracer and new trace API #8657

Closed
isvilen opened this issue Jul 11, 2024 · 2 comments · Fixed by #8754
Closed
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@isvilen
Copy link
Contributor

isvilen commented Jul 11, 2024

With the old trace API, I can use meta tracing and 'trace' function in match specification body to enable 'receive' trace for a specific process:

Tracer = spawn(fun F() -> receive M -> io:format("~p~n",[M]), F() end end),
erlang:trace_pattern({lists, seq, 2},
                     [{'_', [], [{trace, [], ['receive', timestamp, {const, {tracer, Tracer}}]}]}],
                     [{meta, Tracer}]),
spawn(fun () ->
        lists:seq(1,10),
        self() ! message,
        receive
            message -> ok
        end
end).
{trace_ts,<0.89.0>,call,{lists,seq,[1,10]},{1720,685691,308331}}
<0.89.0>
{trace_ts,<0.89.0>,'receive',message,{1720,685691,308357}}

Trying the same thing with new API doesn't work:

Tracer = spawn(fun F() -> receive M -> io:format("~p~n",[M]), F() end end),
Session = trace:session_create(my_session, Tracer, []),
trace:function(Session,
               {lists, seq, 2},
               [{'_', [], [{trace, [], ['receive', timestamp]}]}],
               [meta]),
spawn(fun () ->
        lists:seq(1,10),
        self() ! message,
        receive
            message -> ok
        end
end).
{trace_ts,<0.89.0>,call,{lists,seq,[1,10]},{1720,685744,543604}}
<0.89.0>
@isvilen isvilen added the bug Issue is reported as a bug label Jul 11, 2024
@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Jul 11, 2024
@jhogberg jhogberg added the stalled waiting for input by the Erlang/OTP team label Jul 15, 2024
@jhogberg
Copy link
Contributor

Thanks for your report! Unfortunately most of us are on vacation right now, we'll revisit this once we're back. :-)

@sverker sverker removed the stalled waiting for input by the Erlang/OTP team label Aug 26, 2024
@sverker
Copy link
Contributor

sverker commented Sep 4, 2024

Fix merged to maint branch for OTP-27.1 soon to be released.

@sverker sverker closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants