3

For some reason, when I type "rails s", sometimes I can't shut the server down using CTRL-C. It's using Web brick, the default.

Sometimes it works for hours. Other times it doesn't work at all and I must constantly kill the process if I want to shut down the server.

Is this a known problem? How can I fix it?

If you need to know more info, please just ask and I'll tell you what I can. Because I don't know what is causing it, I am at a loss as to what info to provide you with.

EDIT: I am adding a git repository:

gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost'

But to be fair, I've not had this problem with this line enabled... and I've also had this problem when this gem line didn't exist.

Fire Emblem
  • 5,961
  • 3
  • 24
  • 37
  • Similar question asked here http://stackoverflow.com/questions/5891567/cant-stop-webrick-1-3-1-with-ctrl-c-on-ubuntu-11-04 – peter_budo May 22 '11 at 07:25
  • 1
    From other SO questions [here](http://stackoverflow.com/questions/5891567/cant-stop-webrick-1-3-1-with-ctrl-c-on-ubuntu-11-04) and [here](http://stackoverflow.com/questions/5708329/ctrlc-to-webbrick-server-ignored) its sounds like referencing a gem from it's git repo can cause this issue. Are you passing the `:git => "git://github.com/somerepo.git"` to a gem in you Gemfile? – dwhalen May 22 '11 at 07:29
  • Yep, I am adding a git repository. I'll look at that other question too. Thanks – Fire Emblem May 22 '11 at 07:32

2 Answers2

13

The way I solved this problem was to do the following:

To stop the rails server while it's running, press:

CTRL-C
CTRL-Z

You will get control back to bash. Then type (without the $):

$ fg

And this will go back into the process, and then quit out of Rails s properly.

It's a little annoying, but this sure beats killing the process manually. It's not too bad and it's the best I could figure out.

Fire Emblem
  • 5,961
  • 3
  • 24
  • 37
0

This is a kernel bug that affects Ubuntu 11.04 (it's fixed in 11.10, fwiw). You can install kernel 2.6.39 to fix it.

I'm using the xorg-edgers PPA which includes 2.6.39, and I don't experience the issue.

bratsche
  • 2,666
  • 20
  • 23