Open hongseokyoon opened 4 months ago
If I turn flame on in LiveDashboard and send a request to my Phoenix app, it printed errors.
>>>pid:#PID<0.1082.0> >>>tracer:#PID<0.1082.0> alive?:true >>>self:#PID<0.1087.0> alive?:true process_info:[ current_function: {Process, :info, 1}, initial_call: {:proc_lib, :init_p, 5}, status: :running, message_queue_len: 0, links: [#PID<0.1085.0>], dictionary: [ "$ancestors": [#PID<0.1085.0>, #PID<0.642.0>, #PID<0.641.0>, MyWeb.Endpoint, Owp.Supervisor, #PID<0.475.0>], "$meck_call": {:cowboy_handler, :execute}, "$initial_call": {:cowboy_stream_h, :request_process, 3} ], trap_exit: false, error_handler: :error_handler, priority: :normal, group_leader: #PID<0.474.0>, total_heap_size: 2208, heap_size: 1598, stack_size: 30, reductions: 408, garbage_collection: [ max_heap_size: %{error_logger: true, kill: true, size: 0}, min_bin_vheap_size: 46422, min_heap_size: 233, fullsweep_after: 65535, minor_gcs: 4 ], suspending: [] ] [error] ** can only have one tracer per process [error] Ranch protocol #PID<0.1087.0> of listener OwpWeb.Endpoint.HTTP (connection #PID<0.1085.0>, stream id 1) terminated an exception was raised: ** (ArgumentError) errors were found at the given arguments: * 1st argument: invalid spec for pid or port :erlang.trace(#PID<0.1087.0>, true, [{:tracer, #PID<0.1087.0>}, :call, :return_to, :running, :arity, :timestamp]) (flame_on 0.7.0) lib/flame_on/capture/mock_function.ex:12: FlameOn.Capture.MockFunction.start_if_not_started/1 (flame_on 0.7.0) lib/flame_on/capture/mock_function.ex:27: anonymous fn/3 in FlameOn.Capture.MockFunction.generate/3
Added some log to /lib/flame_on/capture/trace.ex.
/lib/flame_on/capture/trace.ex
defmodule FlameOn.Capture.Trace do alias FlameOn.Capture.Server @flags [:call, :return_to, :running, :arity, :timestamp] def start_trace(tracer) do IO.puts ">>>tracer:#{inspect(tracer, limit: :infinity, pretty: true)} alive?:#{Process.alive?(tracer)}" match_spec = [{:_, [], [{:message, {{:cp, {:caller}}}}]}] :erlang.trace_pattern(:on_load, match_spec, [:local]) :erlang.trace_pattern({:_, :_, :_}, match_spec, [:local]) IO.puts ">>>self:#{inspect(self(), limit: :infinity, pretty: true)} alive?:#{Process.alive?(self())} process_info:#{inspect(Process.info(self()), limit: :infinity, pretty: true)}" :erlang.trace(self(), true, [{:tracer, self()} | @flags]) end def stop_trace do :erlang.trace(self(), false, [:all]) Server.stop_trace() end end
It says that the pid is valid and why does it keep complaining that the first argument is not valid?
@hongseokyoon what version of Elixir/Erlang are you running?
If I turn flame on in LiveDashboard and send a request to my Phoenix app, it printed errors.
Added some log to
/lib/flame_on/capture/trace.ex
.It says that the pid is valid and why does it keep complaining that the first argument is not valid?