【问题标题】:Ruby crashes on windowsRuby 在 Windows 上崩溃
【发布时间】:2011-02-23 05:47:32
【问题描述】:

我遇到了这里描述的相同问题:why-rails-fails-with-ruby-exe-has-encountered-a-problem-and-needs-to-close。即 ruby​​ 因以下错误而崩溃:

ruby.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

我要求这个添加一些细节,因为我没有问这个问题我无法在其中添加信息。所以这不是重复的。


无论我如何运行(在开发或生产中)Ruby 最终都会崩溃,但它似乎在生产模式下更频繁地崩溃。有时按住 F5 键时它会崩溃,但有时我必须间歇地按住并释放它一两分钟。它似乎非常依赖于时间,但我通常可以在不到 60 秒的时间内让它崩溃。

当我刷新 GET 请求时发送 3 次如下:

Started GET "/app/page" for 127.0.0.1 at 2011-02-23 10:57:35 +0530
  Processing by AppController#page as HTML
Rendered pms/dashboard.html.erb within layouts/application (109.4ms)
Completed 200 OK in 141ms (Views: 140.6ms | ActiveRecord: 0.0ms)


Started GET "/app/page" for 127.0.0.1 at 2011-02-23 10:57:35 +0530
  Processing by AppController#page as */*
Rendered pms/dashboard.html.erb within layouts/application (15.6ms)
Completed 200 OK in 187ms (Views: 187.5ms | ActiveRecord: 0.0ms)


Started GET "/app/page" for 127.0.0.1 at 2011-02-23 10:57:35 +0530
  Processing by AppController#page as */*
Rendered pms/dashboard.html.erb within layouts/application (15.6ms)
Completed 200 OK in 219ms (Views: 218.7ms | ActiveRecord: 0.0ms)

如果我快速刷新页面,在 3 个请求中的一个或所有请求中会出现以下错误:

ERROR Errno:ECONNABORTED: An established connection was aborted by the software in your host machine:
   c:/Ruby/lib/1.9.1/webrick/httpresponse.rb:323:in 'write'
   c:/Ruby/lib/1.9.1/webrick/httprespose.rb:323:in '<<'
   c:/Ruby/lib/1.9.1/webrick/httprespose.rb:323:in '_write_data'
   c:/Ruby/lib/1.9.1/webrick/httprespose.rb:295:in 'send_body_string'
   c:/Ruby/lib/1.9.1/webrick/httprespose.rb:186:in 'send_body'
   c:/Ruby/lib/1.9.1/webrick/httprespose.rb:103:in 'send_response'
   c:/Ruby/lib/1.9.1/webrick/httpserver.rb:86:in 'run'

ERROR Errno:ECONNABORTED: An established connection was aborted by the software in your host machine:
   c:/Ruby/lib/1.9.1/webrick/httpserver.rb:56:in 'eof?'
   c:/Ruby/lib/1.9.1/webrick/httpserver.rb:56:in 'run'
   c:/Ruby/lib/1.9.1/webrick/server.rb:183:in 'block in start_thread'

INFO going to shutdown....
INFO WEBrick::HTTPServer#start done

我何时开始收到此错误? 当我在我的项目中添加图像、css 和 javascript 时,我开始收到此错误。我还尝试删除这 3 个中的一个,看看是谁导致了错误,但每次我的 ruby​​.exe 崩溃时,我都会看到错误:

ruby.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

我该如何解决这个问题?


当我启动服务器时,控制台上会打印以下内容:

=>Booting WEBrick
=>Rails 3.0.3 application starting in development on http://0.0.0.0:3000
=>Call with -d to detach
=>Ctrl-C to shutdown server
[2011-02-23 10:59:22] INFO WEBrick 1.3.1
[2011-02-23 10:59:22] INFO ruby 1.9.2 (2010-08-18) [i386-mingw32]
[2011-02-23 10:59:22] INFO WEbrick::HTTPServer#start: pid:2448 port=3000

ruby -v的输出

ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

【问题讨论】:

    标签: windows ruby-on-rails-3 crash


    【解决方案1】:

    ...除了安装程序现在也是崩溃的 1.9.2-p290

    解决方法:

    添加(或更改)

    config.log_level = :warn

    在 config/environments/development.rb 中

    (不是我的解决方案 - 在另一个线程中找到)

    【讨论】:

    • 你是救生员。在阅读您的解决方案之前,我几乎放弃了 cygwin。 (也感谢原始线程)。
    • 我也遇到了 ECONNABORTED 问题,但我目前没有使用 rails。您能说一下如何在不更改 rails 配置的情况下解决这个问题吗?
    • @msknapp:如果您没有使用 Rails,那么您的错误原因可能完全不同。
    【解决方案2】:

    在 Windows 上运行 1.9.2 会使您成为极少数的用户。如果您没有明确需要 1.9,我会使用 1.8.7。具体来说,我会使用 RailsInstaller 中的包:http://railsinstaller.org/

    【讨论】:

    • 如果我往下走,那么我是否必须更改我的编码语法,否则它将由 ruby​​ 1.8.7 管理。
    • 在过去的 3 个月里,我一直生活在地狱中,试图让 3.0.3 在 Windows 7 上运行 1.9 - Rails 会在糟糕的一天崩溃数十次。我最终放弃并将 ruby​​ 降级到 1.8.7。有一些语法更改,但除非您的存储库有数十万行代码,否则我希望您会在一天内领先。我推荐相同的安装程序。
    • 我在 Windows 上使用 Rails 3.0.10 制作了几个应用程序,我遇到的唯一问题是某些版本的 Eventmachine 会炸毁我。也许这对 Windows 用户来说是一个神奇的版本?
    【解决方案3】:

    我在 1.9.2-p290 的 Windows 7 上遇到了同样的崩溃。有人说要清除 development.log 文件。我不敢相信,但在删除我的 12mb development.log 后一切正常。

    【讨论】:

    • hmmm...如果您的服务器运行了很长时间并且 development.log 文件变得太大而导致此问题,这可能是解决方案。
    • 疯了!!谢谢你的回答!
    【解决方案4】:

    本机 (C) 扩展可能失败并导致整个 ruby​​ 崩溃;在我的情况下,它是 sql server 适配器无限循环/使用整个堆;在我们跟踪并修复了适配器(https://github.com/rails-sqlserver/tiny_tds/pull/124)中的错误后,它不会再次失败

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-09
      • 1970-01-01
      • 1970-01-01
      • 2012-07-17
      • 2021-02-04
      相关资源
      最近更新 更多