1

我有一个 Red Hat EL6 服务器(用于生产)。我从源代码安装了 ruby​​ 和 ruby​​gems。

# uname -a
Linux servername 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
# ruby -v
ruby 1.9.3p429 (2013-05-15 revision 40747) [x86_64-linux]

我能够从我的开发机器部署到这个生产服务器。一切正常。我第二天来,得到乘客错误页面。我忘记了错误是什么,它发生在上周。但我什至无法运行命令ruby -v

我试图调查发生了什么,我找不到错误的来源。所以我再次编译 Ruby 和 RubyGems (2.0.3)。一切都恢复正常。我星期一来,得到乘客错误页面:

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1070:in `require': closed stream (IOError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1070:in `<module:Gem>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:114:in `<top (required)>'
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'

这次我可以运行 ruby​​ 命令,ruby -v但我无法运行gem -v,因为我会得到与乘客页面上相同的错误。

所以我转到 ruby​​gems.rb 文件的第 1070 行,查看生成错误的代码行,就是这个...

require "rubygems/specification"

所以我去 ruby​​gems 文件夹,里面有一个 specification.rb 文件。

更新 好的,所以我尝试再次安装 ruby​​gems 并运行ruby setup.rb,这就是我得到的......

# ruby setup.rb
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1070:in `require': closed stream (IOError)
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1070:in `<module:Gem>'
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:114:in `<top (required)>'
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'

有人知道服务器发生了什么吗?我将尝试再次编译 ruby​​gems。它可能会修复错误,但我怀疑明天我会遇到另一个错误。

4

2 回答 2

0

有点远射,但你没有完整的光盘,是吗?

于 2013-06-17T17:59:47.287 回答
0

预链接弄乱了 Rails 应用程序: http ://www.tsheffler.com/blog/ ?p=491

Two articles on the web suggested that the Linux prelink optimizer was actually corrupting the Ruby binary. The solution is to tell the system to BAN prelinking on the Ruby binary. After adding the '-b /usr/bin/ruby' line to the /etc/prelink.conf file as suggested, the problem seems to have gone away.

More info:

于 2013-06-24T18:21:57.103 回答