Consecutive IEx.pry's being skipped / ignored

Hello,

Perhaps a little bit more of a fundamental debugging question, but is there a reason why consecutive IEx.pry's in a recursive context are being skipped after 2 times?

system information output:

System information
> $ elixir -v        
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

Elixir 1.10.3 (compiled with Erlang/OTP 21)

> $ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.4 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.4 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Example code:
defmodule Example do
  require IEx

  def recursive_hi(0), do: IO.puts("hi0")

  def recursive_hi(n) do
    IEx.pry()
    IO.puts("hi#{n}")
    recursive_hi(n - 1)
  end
end
Output when trying to debug with iex -S mix run (compiled module in mix project):
iex(1)> recompile;
Compiling 1 file (.ex)
:ok
iex(2)> Example.recursive_hi 5
Break reached: Example.recursive_hi/1 (lib/ex_gherkin/example/example.ex:7) 

    5: 
    6:   def recursive_hi(n) do
    7:     IEx.pry()
    8:     IO.puts("hi#{n}")
    9:     recursive_hi(n - 1)

pry(1)> n
5
pry(2)> continue
hi5
Break reached: Example.recursive_hi/1 (lib/ex_gherkin/example/example.ex:7) 

    5: 
    6:   def recursive_hi(n) do
    7:     IEx.pry()
    8:     IO.puts("hi#{n}")
    9:     recursive_hi(n - 1)

pry(1)> n
4
pry(2)> continue
hi4
Break reached: Example.recursive_hi/1 (lib/ex_gherkin/example/example.ex:7) 

    5: 
    6:   def recursive_hi(n) do
    7:     IEx.pry()
    8:     IO.puts("hi#{n}")
    9:     recursive_hi(n - 1)

hi3
Break reached: Example.recursive_hi/1 (lib/ex_gherkin/example/example.ex:7) 

    5: 
    6:   def recursive_hi(n) do
    7:     IEx.pry()
    8:     IO.puts("hi#{n}")
    9:     recursive_hi(n - 1)

hi2     
Break reached: Example.recursive_hi/1 (lib/ex_gherkin/example/example.ex:7) 

    5: 
    6:   def recursive_hi(n) do
    7:     IEx.pry()
    8:     IO.puts("hi#{n}")
    9:     recursive_hi(n - 1)

hi1     
hi0     
:ok     

As you can see in the last “output” section, it is possible to pry into it the first 2 times, but after that it just keeps executing without “freezing”. Am I understanding some fundamentals wrong here or?

Right now I’m using the Erlang debugger (:debugger.start / :int.break(__ MODULE __, line) / etc…) to work around this “issue”.

Thank you in advance.

1 Like

Do you have an example project that reproduces this error that you could share here?

If you are able to reproduce, then it may be a bug that was re-introduced somehow and it is worth opening up an issue on Elixir (share the reproducible project in the issue as well). For more context: https://github.com/elixir-lang/elixir/issues/7255

1 Like

Generating a sample project with instructions in the readme. One moment please. I’ll post the link here when its pushed.

Here is the example repository: https://github.com/WannesFransen1994/consecutive_pries .

Curious whether this issue is due to my setup or it is an actual bug!

I agree. Was able to reproduce it.

Here is the system info:

Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Elixir 1.10.1 (compiled with Erlang/OTP 22)

I’d open an issue, it is not the expected behavior with the above. Last time, Jose knew exactly what the issue was an had a fix within 10 mins.

1 Like

Wonderful. Well, not wonderful that there’s a bug but that you were able to reproduce it!

Thank you for taking the time to test this. Opening an issue now and I’ll post the github issue link here later on.

For future readers: opened an issue.