rails runner 的段错误 (Rails 4.0.0 Ruby 2.2.2p95 CentOS7)

Segment Fault with rails runner (Rails 4.0.0 Ruby 2.2.2p95 CentOS7)

这个错误完全超出了我的理解范围,如果需要将它放在其他地方,请告诉我。出于类似的原因,我也不知道这个问题的 'scope' 是什么,所以如果您需要更多信息,请告诉我。

据我所知,该命令执行 运行,但紧接着它抛出段错误。据我所知,没有迹象表明为什么或出了什么问题。有一些警告被抛出,但大多数警告已经存在了一段时间而没有这个错误。

bin/rails runner -eproduction 'puts 1'
/var/www/projects/cdops4/shared/bundle/ruby/2.2.0/gems/activesupport-4.0.0/lib/active_support/values/time_zone.rb:282: warning: circular argument reference - now
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
Rails Error: Unable to access log file. Please ensure that /var/www/projects/cdops4/releases/1430760842/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
/var/www/projects/cdops4/releases/1430760842/app/jobs/parser/taske_parser.rb:132: warning: duplicated key at line 136 ignored: :queue
/var/www/projects/cdops4/releases/1430760842/app/jobs/parser/taske_parser.rb:134: warning: duplicated key at line 149 ignored: :hit_t2
/var/www/projects/cdops4/releases/1430760842/lib/taske_parser.rb:319: warning: duplicated key at line 321 ignored: :t1_wrap_time
1
[BUG] Segmentation fault at 0x00000000000018
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

-- Machine register context ------------------------------------------------
 RIP: 0x00007f459d8a1c00 RBP: 0x00007fff3bc4b570 RSP: 0x00007fff3bc4b1e8
 RAX: 0x0000000000000000 RBX: 0x0000000004fd6b30 RCX: 0x0000000000000000
 RDX: 0x0000000000000001 RDI: 0x0000000000000008 RSI: 0x0000000000000080
  R8: 0x0000000000000000  R9: 0x00000000000000ca R10: 0x00007fff3bc4af70
 R11: 0x00007f459d8a1c00 R12: 0x00007f45868c4bc8 R13: 0x000000000000003d
 R14: 0x0000000000000001 R15: 0x00007fff3bc4b210 EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/usr/local/rvm/rubies/ruby-2.2.2/lib/libruby.so.2.2(rb_vm_bugreport+0x51f) [0x7f459dca1fdf] vm_dump.c:693
/usr/local/rvm/rubies/ruby-2.2.2/lib/libruby.so.2.2(rb_bug_context+0xcb) [0x7f459db35efb] error.c:425
/usr/local/rvm/rubies/ruby-2.2.2/lib/libruby.so.2.2(sigsegv+0x3e) [0x7f459dc158fe] signal.c:879
/lib64/libpthread.so.0 [0x7f459d8a7130]
/lib64/libpthread.so.0 [0x7f459d8a1c00]
/lib64/libtspi.so.1(host_table_final+0x14) [0x7f458667abb4]
/lib64/ld-linux-x86-64.so.2(_dl_fini+0x1ca) [0x7f459dfa7b5a]
/lib64/libc.so.6(__run_exit_handlers+0xd9) [0x7f459cdc0e49]
/lib64/libc.so.6 [0x7f459cdc0e95]
/lib64/libc.so.6(__libc_start_main+0xfc) [0x7f459cda9afc]
[0x4008e9]

**Removed Memory map, Whosebug wouldn't let me submit with it**    

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Aborted

所以我觉得这引起了一些混乱,但我并没有尝试修复日志文件。它重定向到标准输出,那里一切正常。

问题似乎在 tiny_tds 内。删除 gem 并重试防止了新项目中的错误。在我原来的项目上尝试这样做会崩溃(因为项目需要它)。

在这一点上,问题似乎存在于 Ruby 和 tiny_tds gem 的库之间。

这是另一个关于日志文件权限的回答:

希望对您有所帮助

开始引用:

目录应该是 750,而不是 664。另外,您应该将用户添加到 adm 组。这实际上主要是 adm 组的重点:阅读日志。

目录权限与文件权限略有不同。为了简化一堆,目录是名称和地址的列表:名称是文件名,地址是文件的实际位置。 x 权限控制对该列表的访问:为了查找特定文件的地址,您需要在其父目录以及该目录的父目录上执行位等。然后 r 权限控制列表文件:如果您有--x,如果知道文件名就可以访问文件,但不能ls。最后,w 控制创建、重命名和删除文件。因此,为了访问文件,您始终需要 x 位。

另外:不要将日志文件设置为 777。它们应该是 644 或 640,两者之一。两个原因:第一,它们不可执行,所以 x 位应该关闭。其次,更重要的是,普通用户永远不应该写入 Apache 日志文件,只能读取。这是服务器中的潜在安全漏洞。

结束引用:

我们终于找到了问题的根源。我们正在使用一个名为 tiny_tds 的 gem,据我所知,这个 gem 不适用于 centOS 7。一旦它被删除并重新部署,所有问题都解决了。