Does anyone know of a good video showing tips on using Kernel.dbg/2
with IEx? Sounds powerful and a nice intro video would be useful.
This is sexy af many times I’ve had to do each with index to get kind of feature. So, less chances of bugs in these simple spots.
letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
Enum.slice(letters, 0..5//2)
#=> ["a", "c", "e"]
Users might want to use --no-pry
when running Phoenix in IEx, especially with liveview, or you’ll have processes/events/requests timeout.
iex --sname xyz --cookie abc --no-pry -S mix phx.server
There also seems to be some order dependency on the arguments, so watch out for that:
% iex --no-pry --sname local -S mix phx.server
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
--sname : Unknown option
No file named local
As always, thank you <3
Good catch. Fixed in v1.14 and main branches.
@josevalim when I use FROM elixir:1.14-alpine
in my Dockerfile and deploy I’ve noticed that System.version()
returns 1.14.0-rc.0
instead of what I expected -is the alpine for 1.14 the RC and not the stable 1.14 release?
See here:
Why does it cause timeouts without doing --no-pry
?
Because IEx.pry
suspends execution in the view process so it stops responding to other messages. This can cause the surrounding infrastructure to think the view is dead and try to reconnect and then land you in another pry request.
Probably you can alleviate this to a degree by setting some timeouts on the LiveSocket
(which AFAIK inherits all the options from Socket
).
Possibly you’d have to adjust some timers on the Elixir side too, I have not tried.
You could also configure your own dbg
backend to proxy the existing one and perhaps only pry when given an option.
I still don’t understand. What does “pry” stand for? At what level does it have an effect? Which components are impacted? Why did it change in version 1.14? So many questions…
https://hexdocs.pm/iex/1.14.0/IEx.html#pry/0
https://hexdocs.pm/iex/1.14.0/IEx.Pry.html
It’s basically a breakpoint that drops you into a IEx shell, I think the name is inherited from Ruby? At least thats where I first saw it.
Thank you for the link. I have overlooked that it is a flag for elixir shell and only affects code executed through the shell.