8

I've experienced an odd interface glitch.

[44, 53] in /document.rb
    44:     code
    45:   code
    46: 
    47:   def code
    48:     byebug
 => 49:     code
    50:       code
    51:     code
    52:   end
    53: 
(byebug) {here is where you type}

When I type, the characters are not displayed at all. I can type p "yo" or whatever I want, and when I hit enter it runs the code. Essentially I can use byebug in a pinch, but it's really frustrating when I can't see what I'm typing.

I've used byebug in the past with this same laptop, and this issue is fairly recent.

I was assisting a friend, and when he used byebug the same issue happened. I haven't been able to find anything online.

  • 5
    Are you using Spring with Rails? If so disable the spring gem, kill all spring processes, and then retry. – Casper Aug 31 '18 at 20:44
  • 3
    @Casper, that totally fixed it. I didn't even disable the spring gem, I just killed the server, ran `bin/spring stop` and started the server again. It's working now, disabling the spring gem might be a more permanent fix. Thanks! – mrmicrowaveoven Aug 31 '18 at 21:43

2 Answers2

2

TL;DR: Add this line in config/puma.rb:

# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"

Reproducing & Why this is happening

In development mode, set a debugger in a controller action and send a request to this action (e.x. index). After 60 seconds Puma, Rails' default server, will terminate the worker. Unfortunately, the next time a debugger is triggered you will be unable to see any text you type in the terminal.

This is a known bug and is fixed in Rails 7+. The above line was added to change Puma's worker timeout to a more appropriate level (1 hour) when in development mode.

Other Causes

  1. As u/casper pointed out in a comment above, Spring can also cause similar behaviour. Stop your server and run bin/spring stop and this may resolve your issue.
  2. If you're experience only some text appear when you type, this may be a result of parallelized tests. For example, if you type, "Hello World" but only "Hol" appears (i.e. some letters), you can disable parallelized tests following u/sajad-rastegar's advice above. Simply comment this line in test/test_helper.rb: parallelize(workers: :number_of_processors).
Matt
  • 5,800
  • 1
  • 44
  • 40
0

This problem occurs when the tests run in parallel. Commenting this line in test_helper should fix the problem:

parallelize(workers: :number_of_processors)
Sajad Rastegar
  • 3,014
  • 3
  • 25
  • 36