Ruby crashes on windows

2020-03-18 05:44发布

I'm facing same problem described here: why-rails-fails-with-ruby-exe-has-encountered-a-problem-and-needs-to-close. that is ruby get crashed with following error:

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

I'm asking this to add some details on it as that question was not asked by me I am not able to add information in it. So this is not duplicate.


Ruby crashes eventually no matter how I run it (in development or in production), but it seems to crash more often in production mode. Sometimes it will crash when I hold down the F5 key, but sometimes I have to hold and release it intermittently for a minute or two. It appears to be very dependent on timing, but I can usually make it crash in less than 60 seconds.

When I refresh the GET request is sent for 3 times as follows:

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)

And if I rapidly refresh the page get following error in one of or all the 3 request:

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

When I started to get this error? When I added images, css and javascript in my project I started to get this error. I also tried by removing one of this 3 and see who causes the error but every time my ruby.exe get crashed and i see the error:

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

How can I solve this?


When I start server following is printed on console:

=>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

Output of ruby -v

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

4条回答
手持菜刀,她持情操
2楼-- · 2020-03-18 06:02

it is possible that a native (C) extension is failing and bringing the whole ruby down; in my case it was sql server adapter looping indefinitely/using whole heap; after we traced and fixed the bug in the adapter (https://github.com/rails-sqlserver/tiny_tds/pull/124) it does not fail again

查看更多
萌系小妹纸
3楼-- · 2020-03-18 06:14

Running 1.9.2 on windows puts you in a REALLY small minority of users. If you don't have an explicit need for 1.9, I'd use 1.8.7. Specifically, I'd use the package from RailsInstaller: http://railsinstaller.org/

查看更多
Ridiculous、
4楼-- · 2020-03-18 06:19

... except the installer is now ALSO the crashing 1.9.2-p290

Workaround:

Add (or change)

config.log_level = :warn

in config/environments/development.rb

(not my solution - found it in another thread)

查看更多
虎瘦雄心在
5楼-- · 2020-03-18 06:20

i got the same crashes on windows 7 with 1.9.2-p290. someone said to clear development.log file. i can't believe but after deleting my 12mb development.log everything works fine.

查看更多
登录 后发表回答