1

我们有 RHEL 5.8 附带的服务器,未注册 - 所以没有yum。我们直接编译并安装了 Ruby。它有效 - 然后几天后 ruby​​ 程序开始出现段错误。谁能建议从哪里开始寻找这个错误?

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1161: [BUG] Segmentation fault
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0008 p:---- s:0021 b:0021 l:000020 d:000020 CFUNC  :require
c:0007 p:1596 s:0017 b:0017 l:000016 d:000016 CLASS  /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1161
c:0006 p:0079 s:0015 b:0015 l:000014 d:000014 TOP    /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:114
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :require
c:0003 p:0021 s:0006 b:0006 l:000005 d:000005 TOP    <internal:gem_prelude>:1
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000d18 d:000d18 TOP   

-- Ruby level backtrace information ----------------------------------------
<internal:gem_prelude>:1:in `<compiled>'
<internal:gem_prelude>:1:in `require'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:114:in `<top (required)>'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1161:in `<module:Gem>'
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:1161:in `require'

-- C level backtrace information -------------------------------------------
/usr/bin/ruby [0x525545] vm_dump.c:796
/usr/bin/ruby [0x569b96] error.c:258
/usr/bin/ruby(rb_bug+0xb3) [0x569d03] error.c:277
/usr/bin/ruby [0x4b1749] signal.c:633
/lib64/libpthread.so.0 [0x3a1700ebe0]
/usr/bin/ruby(st_lookup+0x26) [0x4b8136] st.c:333
/usr/bin/ruby [0x51c723] vm_method.c:374
/usr/bin/ruby [0x44bcef] object.c:2062
/usr/bin/ruby(rb_convert_type+0x5a) [0x44e87a] object.c:2083
/usr/bin/ruby(rb_string_value_ptr+0x27) [0x4c02c7] string.c:810
/usr/bin/ruby [0x56cabe] load.c:156
/usr/bin/ruby(rb_require_safe+0x20f) [0x56d6cf] load.c:550
/usr/bin/ruby [0x522a94] vm_insnhelper.c:404
/usr/bin/ruby [0x514697] insns.def:1018
/usr/bin/ruby [0x51ad48] vm.c:1236
/usr/bin/ruby(rb_iseq_eval+0x152) [0x51b292] vm.c:1464
/usr/bin/ruby [0x56c486] load.c:310
/usr/bin/ruby(rb_require_safe+0x6c6) [0x56db86] load.c:620
/usr/bin/ruby [0x522a94] vm_insnhelper.c:404
/usr/bin/ruby [0x514697] insns.def:1018
/usr/bin/ruby [0x51ad48] vm.c:1236
/usr/bin/ruby(rb_iseq_eval+0x152) [0x51b292] vm.c:1464
/usr/bin/ruby(ruby_process_options+0x325) [0x4b06c5] ruby.c:1116
/usr/bin/ruby(ruby_options+0x90) [0x4178b0] eval.c:73
/usr/bin/ruby [0x414985] main.c:38
/lib64/libc.so.6(__libc_start_main+0xf4) [0x3a1601d994]
/usr/bin/ruby [0x414889]

-- Other runtime information -----------------------------------------------

* Loaded script: /usr/bin/ruby

* Loaded features:

    0 enumerator.so
    1 /usr/local/lib/ruby/1.9.1/x86_64-linux/enc/encdb.so
    2 /usr/local/lib/ruby/1.9.1/x86_64-linux/enc/trans/transdb.so
Segmentation fault
4

1 回答 1

1

一个疯狂的猜测。

RHEL 系统默认配置为将共享库预链接到随机地址,每 2 周一次。

也许您的 ruby​​ 副本在预链接时无法正常工作?

它在全新构建后开始工作,然后在所有共享库上执行预链接,并停止工作,直到下一次全新安装。

您可以通过运行来确定该库是否已预链接:

readelf -l encdb.so | grep LOAD | head -1

未预链接的库将在0. 预链接库将其设为非零。

更新:此链接表明 Ruby 确实可能不适用于预链接。那里的解决方案(为后代复制):

添加-b /usr/bin/ruby到您的/etc/prelink.conf文件中,这告诉prelink您不要触摸ruby解释器。

于 2013-11-10T01:22:39.210 回答