Fl4m3Ph03n1x
Error when using function in recon_trace.calls
Background
I have an app that is printing the following error every 2 or 3 seconds:
=ERROR REPORT==== 14-Jun-2019::14:31:35.089496 ===
Unexpected message: {#Ref<0.2607974300.3493068808.175359>,badarg}
I want to find out it’s source.
Error
To catch the process responsible, I am using recon_trace the following way (an example follows):
:recon_trace.calls({:system_information, :handle_info, fn({_ref, :badarg}, _state) -> :ok end}, 10)
However this is failing with the following error:
:recon_trace.calls({:system_information, :handle_info, fn({_ref, :badarg}, _state) -> :ok end}, 10)
Error: dbg:fun2ms requires fun with single variable or list parameter
** (CaseClauseError) no case clause matching: {:error, :transform_error}
(recon) src/recon_trace.erl:494: :recon_trace.validate_tspec/3
(recon) src/recon_trace.erl:424: :recon_trace."-trace_calls/3-lc$^0/1-0-"/2
(recon) src/recon_trace.erl:426: :recon_trace.trace_calls/3
I am quite confused here. My interpretation of the documentation suggests this should be possible, based on the following sample (in erlang):
All calls to
iolist_to_binary/1made with a binary as an argument already (kind of useless conversion!):recon_trace:calls({erlang, iolist_to_binary, fun([X]) when is_binary(X) -> ok end}, 10)
Question
What am I doing wrong?
Marked As Solved
NobbZ
Also Liked
NobbZ
You need to match on a list of argument in your match func. Similar to how you would specify a list in a MFA tuple.
edit
Back at a computer rather than a mobile:
:recon_trace.calls({:system_information, :handle_info, fn [{_ref, :badarg}, _state]) -> :ok end}, 10)
This might work…
Fl4m3Ph03n1x
Like this?
:recon_trace.calls({:system_information, :handle_info, fn([{ref, :badarg}, _state]) when is_reference(ref) -> :ok end}, 10)
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









