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

查看:31
本文介绍了无法在 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

从另一个终端标准终止进程也不起作用,但 kill -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 与 gem 的交互引起的这一事实使我现在相信这个问题实际上 忽略Webbrick 服务器的CTRL+C ,尽管上面的测试用例表明,这显然不是使用:git 作为gem 引起的.

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 中,我提到我将范围缩小到一个 gem.当我浏览那颗宝石时,我最终找到了真正的罪魁祸首.gem 进行了一次系统调用.我对测试脚本做了一个非常小的修改,我不再加载 barista 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

这可以解释这个问题与CTRL+C 忽略 Webbrick 服务器 之间的相似之处.我的预感是他们提到的 gem 也会进行系统调用.

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 中引入的内核回归(http://redmine.ruby-lang.org/issues/4777 )

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天全站免登陆