robskrob
robskrob

Reputation: 2898

Byebug terminal output is inconsistent and buggy

Whenever I drop a debugging breakpoint with byebug, I am noticing inconsistencies with the text that I type. For instance, I am able to type the first 2-3 characters. However, after the first 2-3 characters, the terminal starts adding random square brackets and other characters. For instance when I type env, Byebug outputs: eenv, or when I try to access a key in env Byebug outputs something even worse: ^[[Aenv['QUERY_STRING'']^[[.

Has anyone ran into this problem with Byebug?

Upvotes: 4

Views: 675

Answers (2)

This is a parallelization issue. Either with multiple workers while running rails server, OR in my case it was:

class ActiveSupport::TestCase
  # Run tests in parallel with specified workers
  parallelize(workers: :number_of_processors) # <--- this is a madness freaking root
end

byebug (and any bb-based gem) terminal input going nuts after hitting a break point in this case

Upvotes: 0

Mellow
Mellow

Reputation: 701

A similar issue occurred to me while working in ruby on rails, using multiple workers. I am making the assumption here that OP is using rails because env and query strings are mentioned in the output.

So, if you are running multiple workers while debugging, they can cause this sort of behaviour, because code is still being executed after the byebug breakpoint is hit, and more importantly: while you try to type letters in the terminal, causing input to get jumbled. Debugging middleware can exacerbate this behaviour, since middleware is always hit, causing this issue to happen only while debugging certain components but not for an example controllers.

Ensure that only one worker is hitting your breakpoint at a time. This could be done by setting your development environment to never run more than 1 worker at least for the time being

Upvotes: 3

Related Questions