deivid-rodriguez / byebug

Debugging in Ruby 2
BSD 2-Clause "Simplified" License
3.34k stars 328 forks source link

step executes many statements sometimes #677

Open p-mongo opened 4 years ago

p-mongo commented 4 years ago

Problem description

When I insert byebug in https://github.com/p-mongo/tenex, which is a Sinatra application, when it is processing a web request, I am often able to step through several lines of code with next but frequently when I type step on a certain line to go into a method, what seems to happen is the balance of the work that my application does as part of that request processing is performed and the next place where byebug stops is somewhere in sinatra, potentially just up the call stack from my application's code.

This seems to happen specifically when I am trying to step into a method that (eventually) ends up making some network requests, or calls other methods that do. I am not sure whether this is the only case when the problem manifests but it definitely seems like most of the time when I run into it I am trying to debug something network-related.

byebug 11.1.3 ruby 2.7.0p0 (upgrading to 2.7.1 now) I tried ruby 2.6.5 or 2.6.6 and it behaved the same

Before I work on narrowing down the reproduce case I am wondering if any of the above description is familiar and what might be causing it.

Expected behavior

I expect step to step into a method and stop at the top of it.

Actual behavior

step occasionally seems to run through the complete method being stepped into, some more application code and stop a few levels of stack above where the command was issued.

I can manually set a breakpoint in the skipped code and byebug will stop when it is reached, which is how I am presently working around this issue.

Steps to reproduce the problem

TODO