Rails 3 Crashing On Windows 7

Hi guys,

I have Rails 3 running on Windows 7 with Ruby 1.9.2

Every now and again, my server crashes, and I see the following information in the windows event log:

Faulting application name: ruby.exe, version: 1.9.2.180, time stamp: 0x4d5ee5ed Faulting module name: msvcrt-ruby191.dll, version: 1.9.2.180, time stamp: 0x4d5ee5ec Exception code: 0xc0000005 Fault offset: 0x0011a00e Faulting process id: 0x1624 Faulting application start time: 0x01cbfc46036ca1be Faulting application path: C:\Ruby192\bin\ruby.exe Faulting module path: C:\Ruby192\bin\msvcrt-ruby191.dll Report Id: ae8872dc-6839-11e0-ae3f-904ce5fafcb7

I have no clue what is causing this error, but it is a pain to try to get work done when my app keeps crashing.

Initially, I thought it was Webrick, so I replaced the server with mongrel. Obviously, this was not the issue.

I am at the end of my tether now and would like any assistance!

thanks,

Lee

Can you provide a list of the gems involved in your application?

That way we would be able to assist you better.

sure:

C:\Windows\System32>gem list

*** LOCAL GEMS ***

abstract (1.0.0) actionmailer (3.0.5) actionpack (3.0.5) activemodel (3.0.5) activerecord (3.0.5) activeresource (3.0.5) activesupport (3.0.5, 2.3.11) annotate-models (1.0.4) archive-tar-minitar (0.5.2) arel (2.0.9) builder (2.1.2) bundler (1.0.10) cgi_multipart_eof_fix (2.5.0) columnize (0.3.2) configuration (1.2.0) diff-lcs (1.1.2) erubis (2.6.6) extlib (0.9.15) faker (0.9.5) gem_plugin (0.2.3) heroku (1.19.1) highline (1.6.1) i18n (0.5.0) launchy (0.3.7) linecache19 (0.5.11) mail (2.2.15) mime-types (1.16) minitest (1.6.0) mongrel (1.2.0.pre2 x86-mingw32) mysql2 (0.2.6 x86-mingw32) polyglot (0.3.1) populator (1.0.0) rack (1.2.2) rack-mount (0.6.14) rack-test (0.5.7) rails (3.0.5) railties (3.0.5) rake (0.8.7) rdiscount (1.6.8) rdoc (2.5.8) rest-client (1.6.1) rhodes (2.3.2) ruby-debug-base19 (0.11.24) ruby-debug-ide19 (0.4.12) ruby-debug19 (0.11.6) ruby_core_source (0.1.4) templater (1.0.0) thor (0.14.6) treetop (1.4.9) tzinfo (0.3.25)

thanks for the reply

sorry, they are all the gems on my system.

I only use the following: (from Gemfile)

  gem 'annotate-models', :require => 'annotate_models'   gem 'ruby-debug19'   gem 'populator'   gem 'faker'   gem "mongrel", '1.2.0.pre2'

sorry, they are all the gems on my system.

I only use the following: (from Gemfile)

gem ‘annotate-models’, :require => ‘annotate_models’

gem ‘ruby-debug19’

gem ‘populator’

gem ‘faker’

gem “mongrel”, ‘1.2.0.pre2’

What exactly is your application trying to do when it crashes?

B.

It seems to die while processing dynamic javascript...

I have a controller for managing the dynamic javascript (as documented here: #88 Dynamic Select Menus - RailsCasts)

The exact lines that appear in the development.log file before the app crashes are:

Started GET "/javascripts/products.js" for 89.100.131.129 at 2011-04-18 15:23:49 +0100   Processing by JavascriptsController#products as JS

and the products.js.erb file contains:

var products = new Array();

<% Product.all.each do |p|%> products[<%= p.id %>] = {'id':'<%= p.id %>', 'name':'<%= p.name %>', 'price':<%= p.price %>}; <% end %>

thanks

It seems to die while processing dynamic javascript…

I have a controller for managing the dynamic javascript (as documented

here: http://railscasts.com/episodes/88-dynamic-select-menus)

The exact lines that appear in the development.log file before the app

crashes are:

Started GET “/javascripts/products.js” for 89.100.131.129 at

2011-04-18 15:23:49 +0100

Processing by JavascriptsController#products as JS

and the products.js.erb file contains:

Is there another javascript file in your javascripts directory called products.js? The log is looking for that file but the examples you sent and the railscast are looking for products.js.erb.

B.

No, there is only the .js.erb file mentioned above.

My public javascripts directory doesn't contain that file.

The thing is that it doesn't always crash, it seems to be very random.

I am so lost as to the cause, but I really need to find a workaround as it is very annoying trying to get any work done and having to restart the server all the time.

thanks

No, there is only the .js.erb file mentioned above.

My public javascripts directory doesn’t contain that file.

The thing is that it doesn’t always crash, it seems to be very random.

I am so lost as to the cause, but I really need to find a workaround

as it is very annoying trying to get any work done and having to

restart the server all the time.

Can you post the full error that is placed into the development.log at the time of the crash? Also post the error that is being logged to Event Viewer when it crashes.

Thanks, B.

The development log file simply stops tailing...

the last output lines are always something like:

Started GET "/javascripts/products.js" for 89.100.131.129 at 2011-04-18 15:23:49 +0100   Processing by JavascriptsController#products as JS

with no output after it.

In the windows event viewer at the exact time of the crash is the following information:

Faulting application name: ruby.exe, version: 1.9.2.180, time stamp: 0x4d5ee5ed Faulting module name: msvcrt-ruby191.dll, version: 1.9.2.180, time stamp: 0x4d5ee5ec Exception code: 0xc0000005 Fault offset: 0x0011a00e Faulting process id: 0x15e0 Faulting application start time: 0x01cbff46fbcfd114 Faulting application path: C:\Ruby192\bin\ruby.exe Faulting module path: C:\Ruby192\bin\msvcrt-ruby191.dll Report Id: 9c20f6fb-6b4e-11e0-b27b-904ce5fafcb7

thanks

another thing... it seems to happen a lot when accessing the application with multiple simultaneous clients....

this may not be the cause, but might be a hint

another thing… it seems to happen a lot when accessing the

application with multiple simultaneous clients…

this may not be the cause, but might be a hint

When you installed Ruby on Windows did you use RubyInstaller to do it? If so did you also install the DevKit?

B.

yes, I used the RubyInstaller to install:

ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

and I also installed devkit and configured it to embed itself into the above install.

sure:

Hello, sorry for the late response, didn't monitor this group actively.

C:\Windows\System32>gem list

*** LOCAL GEMS ***

abstract (1.0.0) actionmailer (3.0.5) actionpack (3.0.5) activemodel (3.0.5) activerecord (3.0.5) activeresource (3.0.5) activesupport (3.0.5, 2.3.11) annotate-models (1.0.4) archive-tar-minitar (0.5.2) arel (2.0.9) builder (2.1.2) bundler (1.0.10) cgi_multipart_eof_fix (2.5.0) columnize (0.3.2) configuration (1.2.0) diff-lcs (1.1.2) erubis (2.6.6) extlib (0.9.15) faker (0.9.5) gem_plugin (0.2.3) heroku (1.19.1) highline (1.6.1) i18n (0.5.0) launchy (0.3.7) linecache19 (0.5.11) mail (2.2.15) mime-types (1.16) minitest (1.6.0) mongrel (1.2.0.pre2 x86-mingw32) mysql2 (0.2.6 x86-mingw32) polyglot (0.3.1) populator (1.0.0) rack (1.2.2) rack-mount (0.6.14) rack-test (0.5.7) rails (3.0.5) railties (3.0.5) rake (0.8.7) rdiscount (1.6.8) rdoc (2.5.8) rest-client (1.6.1) rhodes (2.3.2) ruby-debug-base19 (0.11.24) ruby-debug-ide19 (0.4.12) ruby-debug19 (0.11.6) ruby_core_source (0.1.4) templater (1.0.0) thor (0.14.6) treetop (1.4.9) tzinfo (0.3.25)

thanks for the reply

On this list you have a couple of things:

mongrel: is known that mongrel do not work with Rails 3, not even using "rails server"

Remove that so Rails do not get confused.

You also have mysql2, which like mysql gem, depends on a specific version of libmysql.dll

I just closed a bug report on Ruby similar to yours:

Please see the comments, the outstanding issue was an incorrect version libmysql.dll

Please verify that.

Well, I only moved to mongrel as I thought that webrick was the culprit for the app crashing.

When I ran on webrick, previously, the app still crashed like it does now.

It still crashes now, but I don't think that mongrel has anything to do with it.

I had a lot of issues at the start with the mysql install, and had to try out a lot of different versions of the libmysql.dll file.

I think I tried at least 4 different versions of the file, and finally got one that allowed me to start the app.

Do you think that this could be the cause of my app crashing? If so, how do I find out exactly what version of libmysql.dll I should be using? Again, I have tried other versions of this file already, but all the other versions were very unstable and resulted in a lot of errors when starting the app.

thanks again for your assistance,

Lee

I had a lot of issues at the start with the mysql install, and had to try out a lot of different versions of the libmysql.dll file.

That is the first mistake.

Try out anything under the sun is a potential root of segfaults.

Binaries are very "picky" about which DLL is used against them. MySQL is a bitch in that sense, their own DLL do weird things between versions.

I think I tried at least 4 different versions of the file, and finally got one that allowed me to start the app.

Do you think that this could be the cause of my app crashing? If so, how do I find out exactly what version of libmysql.dll I should be using?

If you installed mysql 2.8.1, the libmysql.dll is the one I indicated in the blog (which was linked from the Ruby redmine bug report. Did you actually read it?

Again, I have tried other versions of this file already, but all the other versions were very unstable and resulted in a lot of errors when starting the app.

32bits needs 32bits libmysql.dll, If your system is 64bits, is highly likely you have a 64bits MySQL which is not compatible.

Honestly I'm getting tired to shed some light on this type of issues over and over and over again, so added a entry to the RubyInstaller troubleshooting guide:

If you still have issues, please remove any libmysql.dll from your Ruby installation or path and then follow the steps there.

I'm not blaming you, is the lack of information or concise guide to direct newcomers. The info is out there, the problem is that is cannot be easily found.

I am going to tackle this problem this weekend,

I've been really busy this week and havn't had a chance to try out your fix.

thanks for the reply

I have decided to do away with developing on Windows.

I ended up installing Ubuntu to a seperate partition on my machine.

It seems to be a lot easier to get rails up and running on it.

Thanks for your help