Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very obscure issue with Ctrl + C in console not workng and periodic freezes #1074

Closed
lighthouse-import opened this issue May 16, 2011 · 3 comments

Comments

@lighthouse-import
Copy link

Imported from Lighthouse. Original ticket at: http://rails.lighthouseapp.com/projects/8994/tickets/6760
Created by VirtualFunction - 2011-05-01 01:42:32 UTC

There's a good chance this is a Ruby bug with the way it deals with process management, but I'm posting it here because Rails is the only place it affects me. Now I know the issue, I can work round it, but it's something caused me a hell of a lot of frustration trying to track this down.

I had issues with Ctrl + C not working in "rails console" (it wasn't working), and occasionally I found "reload!" and some methods freezing up Ruby. (I had to use kill -9 to terminate things, a normal 'kill' didn't work. I went down alsorts of paths looking at gems, etc. After several hours I realised the issue went away if I booted into Maverick's kernel (2.6.35) instead the natty kernel (2.6.38). After more fiddling I also found that changing my database.yml also got round the issue. It turns out the call to hostname in some ERB in my database.yml was the cause after 3-4 hours of hair pulling!

I'm running Ruby trunk, Rails 3.0.7, and Ubuntu Natty.

To replicate the issue:

On natty and Rails 3.x, create a new project 'rails new tester'. Edit config/database.yml and put echo in config/application.rb, then run "rails console". Try and press Ctrl + C once loaded, it probably won't do anything. Loading irb normally and pressing Ctrl + C will work fine.

While the loack of Ctrl + C is merely an annoyance, I find that if you use backticks in code that runs after "reload!" is called, or use backticks a lot in general, the console seems to lock up very randomly and that kill -9 is needed. This doesn't happen if I revert back to Maverick kernel, 2.6.35.

As a result, I guess this is a corner case shell-spawning/process/threading issue in Ruby itself, and not Rails. However I only seem to replicate this is Rails for now, hence reporting. It seems the Dependency system in ActiveSupport is what triggers this, as I can't replicate this in irb.

I'm guessing some other people will have report process/threading issues like what I've mentioned above but obviously manifest very differently depending on how their code utilises backticks.

Hopefully someone smarter than me will be see what is happening and will be able to pass this upstream to the Ruby devs, explaining to them a way to replicate it without Rails so it can be fixed.

When my console instance locks up, if I attach strace to it I get a constant loop of:

sched_yield() = 0

@lighthouse-import
Copy link
Author

Imported from Lighthouse.
Comment by Daniel Choi - 2011-05-04 16:46:13 UTC

I have the same issue after I upgraded to Ubuntu 11.04. I tried reinstalling ruby 1.9.2 via RVM but that didn't fix the problem.

@lighthouse-import
Copy link
Author

Imported from Lighthouse.
Comment by Daniel Choi - 2011-05-04 16:48:52 UTC

There's a similar ticket filed for Ruby 1.9.2

http://redmine.ruby-lang.org/issues/4608

@rohitarondekar
Copy link
Contributor

This is not a Rails issue.

P.S I use Ubuntu 11.04 and face the same problem, what works for me is doing Ctrl + C, Ctrl + Z and then fg. Don't ask me why or how but that exits the program as ctrl + C would make it. :)

jake3030 pushed a commit to jake3030/rails that referenced this issue Jun 28, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants