【问题标题】:Why is ruby crashing?为什么红宝石会崩溃?
【发布时间】:2012-02-15 14:51:02
【问题描述】:

我正在尝试使用来自git://github.com/ericpaulbishop/redmine_git_hosting.git 的“redmine_git_hosting”

当我尝试访问它时,/var/log/apache2/error.log 出现错误:

/lib/redmine/scm/adapters/git_adapter.rb:26: warning: already initialized constant GIT_BIN

我可以访问 Redmine 网站,但如果我刷新我会得到:

/usr/share/redmine_dev/lib/redmine/scm/adapters/git_adapter.rb:26: warning: already initialized constant GIT_BIN
[ pid=31351 thr=3075225872 file=ext/apache2/Hooks.cpp:817 time=2012-02-15 15:41:08.102 ]: The backend application (process 3677) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.
[ pid=3677 thr=-609445668 file=utils.rb:176 time=2012-02-15 15:41:08.103 ]: *** Exception NameError in application (uninitialized constant Redmine::Scm::Adapters::CommandFailed) (process 3677, thread #<Thread:0xb75931b8>):

我收到 500 内部错误。

top 我可以看到一个 Ruby 进程被杀死了。

我的环境是:

  • Ubuntu 11.10
  • PostgreSQL 8.4
  • Apache2.20
  • Ruby 1.8.7
  • Redmine 1.3.0
  • Phusion 版本 3.0.11
  • 导轨 (2.3.14)
  • Rubygems 1.6.2

【问题讨论】:

  • 你没有给我们足够的工作;我们需要看源码。
  • 警告可能是问题的一部分,也可能不是问题的一部分——它只是一个警告。输出似乎表明了更大的问题:*** Exception NameError in application (uninitialized constant Redmine::Scm::Adapters::CommandFailed) (process 3677, thread #&lt;Thread:0xb75931b8&gt;):

标签: ruby-on-rails ruby apache2 redmine redmine-plugins


【解决方案1】:

这似乎与针对 Chiliproject 分支报告的错误相同:https://www.chiliproject.org/issues/828

这似乎只发生在开发模式下,在第一个请求之后(从第二个请求开始),因为 rails 会卸载您的模块,因此您不必在每次进行更改时都重新启动应用程序。 在 application_controller 中,所有 scm 存储库类都会在每次请求时使用 require_dependency 再次加载。但是这些 scm 所依赖的模块例如 git_adapter 和 abstract_adapter 会被标准 ruby​​ 要求加载,因此它们不会再次加载。 因此,开发中的未初始化常量错误。

建议的解决方案是

...从模块中删除需求并将它们集成到 application_controller :

  require_dependency 'redmine/scm/adapters/abstract_adapter'
  Redmine::Scm::Base.all.each do |scm|
      require_dependency "repository/#{scm.underscore}" 
      require_dependency "redmine/scm/adapters/#{scm.underscore}_adapter" 
  end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-28
    • 2017-08-11
    • 1970-01-01
    • 1970-01-01
    • 2013-10-17
    相关资源
    最近更新 更多