Fl4m3Ph03n1x
Is it possible to use Rexbug to trace messages send/received by processes?
Background
We have an app the keeps running. This is a OTP application that has other OTP applications as dependencies. It uses GenServers and Supervisors as do many of its dependencies.
Problem
The app doesn’t crash, but it constantly prints the following error:
=ERROR REPORT==== 14-Jun-2019::14:31:35.089496 ===
Unexpected message: {#Ref<0.2607974300.3493068808.175359>,badarg}
Rexbug?
I was told about this library, but after reading the README page I could not find any examples of message tracing between processes. I know Rexbug is a wrapper for the erlang counterpart, but I am not familiar with it either.
Questions
- Can this library help me in my task?
- Is it suitable for our use case? If not, what are the alternatives?
Trending in Questions
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
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
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #performance










First 9 of 9 Posts
idi527
What’s your use case exactly?
Do you want to get the incoming messages for a process?
Then maybe
:sys.trace/2. Also check out sys and proc_lib — Erlang System Documentation v29.0.2. But it would be useless, since you already know the “faulty” message:{#Ref<0.2607974300.3493068808.175359>,badarg}.Also note that unlike redbug it might cause performance problems if enabled on a busy process.
So I guess you want to either know the process that received the faulty message (that info should be printed somewhere in the rest of the error report):
Or you want to know the process that sent it. Not sure about this one, but it should be possible to find out once you know the callback module for the process that received it, look for anything that calls
make_refand sends a message to an erlang lib that might reply with a:badarg.Fl4m3Ph03n1x
I already tried
:erlang.traceand:erlang.trace_patternbut none of them were able to catch the process responsible. There is a chance I am miss using these tools, so I was looking for something easier the use but with a similar level of power.This is actually fine for us. We are ok with sinking a machine if it provides us with the data we need to fix all the others. We see it as a sacrificial lamb
We are open to all avenues here.
There is no error report. The message I show in the original post is all we get to work with. The only clue OTP gives us.
idi527
Can you post your logger config here? And
:extra_applictionsfrom yourmix.exsif possible.NobbZ
Also please tell us which version of Elixir and OTP you are running @Fl4m3Ph03n1x, some of the nice Logger things are only available with more recent versions of both…
idi527
Just in case, here’s what I get in one of my apps running in a release built with erlang 21.0 and elixir 1.8 when I send one of the genservers an “unexpected” message:
michalmuskala
I’m not really sure about
redbug, but withdbgcaptureing a process that sends{ref, :badarg}messages would look something like:You’ll start receiving log messages in the shape of:
Which means process
<0.108.0>sent the above message to<0.117.0>.Fl4m3Ph03n1x
Logger configs:
Elixir, OTP and erlang versions:
So if I just place that in a remote iex shell connected to the application, it should work, right?
Will try it out for sure!
NobbZ
Try handling OTP and SASL reports via Logger, also enable more metadata, at least temporarily. If in doubt just use
:all.Then you’ll get nicer output and it’s in a single line rather then in the block like thing that you get now…
bryanhuntesl
You could match the process identifiers and MFA on send / receive ?