Search code examples
erlangtraceyaws

Erlang Tracing: Failed to open trace


I am currently observing traces of Erlang programs (using the Erlang:trace function), specifically the YAWS web server, although my problem may not be limited to this particular program.

Basically, when I attempt to trace some processes and output these traces, the following errors are displayed:

=ERROR REPORT==== 30-Mar-2014::15:48:25 === Failed to open trace "trace.<0.4084.0>.traffic": "I/O error"

=ERROR REPORT==== 30-Mar-2014::15:48:25 === Failed to open trace "trace.<0.4085.0>.traffic": "I/O error"

=ERROR REPORT==== 30-Mar-2014::15:48:26 === Failed to open trace "trace.<0.4086.0>.traffic": "I/O error"

I would appreciate any insight into why this error is occurring and how it can be solved.

Thanks!

EDIT: This is the code I am using:

looper()->
    receive
        P-> io:format(" trace msg: ~p ~n", [P])
    end,
    looper().

tracer2(Pid)->
    erlang:trace(Pid,true,[set_on_spawn, send, 'receive']),
    looper().

In the cmd, I first enter: ybed_sup:start_link() , then enter tracer2(PID) passing the PID of the process executing the function yaws_server:acceptor as a parameter.

At first, traces are printed correctly, but then this process dies and new processes with the functon yaws_server:acceptor are spawned, after which only the error messages show.


Solution

  • I think you might be confusing Erlang tracing and the tracing capabilities Yaws provides for HTTP requests. They are very different things.

    The error you're seeing is caused by Yaws being unable to open the files mentioned in your error messages (for example, trace.<0.4084.0>.traffic), which by default are opened in the logdir specified in the yaws.conf file. You can read more about this near the top of the yaws.conf documentation or in the yaws.conf.5 man page that's part of your Yaws installation.