I’ve noticed that when I’m using IEx.pry() with LiveView in a fairly complex application with lots of processes interacting, when I throw an IEx.pry, the REPL session can be “eaten” by a crash/timeout in another process, and I’ll lose the context in the REPL. It’s very annoying and can make debugging a PITA.
Is there a solution for this? I’d like to have pry, but that it totally pauses all other processes until I’m done. Does this exist?
Well, you can try one of these solutions, but none of them will be generic.
You can try to :sys.suspend processes which cause timeout before calling the IEx.pry
You can try to tolerate the exits in links with Process.flag :trap_exit, true
But I’d just suggest to connect iex into running system, and debug the system using :sys module. It is very powerful and can change processes’ state in runtime, suspend/resume processes and show debug information such as received and sent messages
If :sysdon’t cover your needs, you can always use oldschool tracing. But for me, :sys and Process.info provide 99% of necessary information and solve 99% of problems
This is basically what spry does, it’ll call :erlang.suspend_process on everything it can find and safely suspend, and then :erlang.resume_process on everything it halted once the session is over. It’s like using a sledgehammer to crack an egg, but it works for me.