无法在Ubuntu 11.04上使用ctrl-c停止WEBrick 1.3.1 [英] Can't stop WEBrick 1.3.1 with ctrl-c on Ubuntu 11.04

查看:122
本文介绍了无法在Ubuntu 11.04上使用ctrl-c停止WEBrick 1.3.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用RVM,Ruby 1.9.2和Rails 3.0.7

I'm using RVM, Ruby 1.9.2, and Rails 3.0.7

从另一个终端进行标准的进程终止也不起作用,但是杀死-9当然可以.

A standard kill of the process from another terminal doesn't work, either, but kill -9 does, of course.

我发现了一个类似的问题,对Webbrick服务器的CTRL + C被忽略了,但是目前尚不清楚该问题是否描述了同样的根本问题.另外,该分辨率似乎并不适用,因为我没有在Gemfile中使用:git.

I found a similar question, CTRL+C to Webbrick server ignored, but it's unclear whether that question is describing the same underlying issue. Also, the resolution doesn't seem to apply, since I'm not using :git in my Gemfile.

更新1:(现在已存在,请参阅下面的更新2,了解更多信息)

update 1: (old now... see update 2, below, for the real scoop)

我设法将问题缩小为一个宝石.如果您提供以下测试脚本,您也可以看到该问题(假设您使用的是Ubuntu 11.04 ...在10.04中没有问题)

I managed to narrow the issue down to a single gem. If you source the following test script, you can see the issue, too (assuming you're on Ubuntu 11.04... there was no issue in 10.04)

rm -rf tmpkilltest

rvm 1.9.2
rvm --force gemset delete tmpkilltest
rvm gemset create tmpkilltest
rvm 1.9.2@tmpkilltest

gem install rails -v=3.0.7 --no-rdoc --no-ri
gem install sqlite3 -v=1.3.3 --no-rdoc --no-ri

rails new tmpkilltest

cd tmpkilltest

echo "gem 'barista', '1.0'" >> Gemfile

bundle

rails s

该问题是由Rails与宝石的交互作用引起的,这使我现在相信这个问题实际上

The fact that the issue is caused by Rails' interaction with a gem leads me to now believe that this question actually is related to CTRL+C to Webbrick server ignored, though the test case above shows that this one is clearly not caused by using :git for a gem.

更新2:

更新1 中,我提到我将其范围缩小为一个宝石.当我经历那颗宝石时,我最终发现了 real 罪魁祸首. gem正在进行单个系统调用.我对测试脚本进行了非常小的修改,不再加载咖啡师gem,而是在application.rb的末尾附加了一个系统调用.通过该系统调用,ctrl-c不起作用.删除系统调用,它确实起作用.

In update 1 I mentioned that I narrowed it down to a gem. When I went through that gem, I eventually found the real culprit. The gem was making a single system call. I've made a very minor modification to the test script where I no longer load the barista gem, but rather I simply append a single system call at the end of the application.rb. With that system call, ctrl-c doesn't work. Remove the system call and it does work.

rm -rf tmpkilltest

rvm 1.9.2
rvm --force gemset delete tmpkilltest
rvm gemset create tmpkilltest
rvm 1.9.2@tmpkilltest

gem install rails -v=3.0.7 --no-rdoc --no-ri
gem install sqlite3 -v=1.3.3 --no-rdoc --no-ri

rails new tmpkilltest

cd tmpkilltest

bundle

echo "\`date\`" >> config/application.rb

rails s

这可以解释此问题与对Webbrick服务器忽略的CTRL + C之间的相似之处.我的直觉是他们提到的宝石也可以进行系统调用.

This could explain the seeming similarity between this question and CTRL+C to Webbrick server ignored. My hunch is that the gem they mention also makes a system call.

推荐答案

好的,该问题已为我解决.我最近将其作为Ubuntu标准更新的一部分进行了内核更新,从而解决了该问题.

Ok, the issue has been resolved for me. A recent kernel update, which I applied as part of Ubuntu's standard updates, fixed the problem.

此外,这里是对该问题的很好的讨论,它解释了根本原因是2.6.38(

Also, here is a good discussion of the issue, which explains that the root cause was a kernel regression introduced in 2.6.38 ( http://redmine.ruby-lang.org/issues/4777 )

该回归已得到修补,看起来该修补程序最近已将其纳入Ubuntu的更新中,因此,如果您受到此问题的影响,则应应用最新更新.

The regression was patched, and it looks like the patch recently made it into Ubuntu's updates, so if you're being affected by this issue, you should apply the latest updates.

这篇关于无法在Ubuntu 11.04上使用ctrl-c停止WEBrick 1.3.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆