ruby.exe crashing on windows xp

G

Glory L.

Hi there,

I am using ruby 1.9.2p180 and with rails 3.0 but I am getting ruby.exe
to crash fairly often. I understand this is a ruby forum over rails yet
I do not know what is the culprit. I have seen Rails 3.0 with a simple
web app work so I am baffled. I switched to using Mongoid/Haml and
started creating an app with application templates. The crash often
happens when I submit a form in a view and even a simple valid case can
crash ruby.exe. There is no errors written to the development log so I
have no trace from an application level.

Has anyone else experienced this? I am running Ruby on Windows XP.
Attached is the crash file. I am hoping this can go into the right
person as this issue halts my progress.

Attachments:
http://www.ruby-forum.com/attachment/6196/f7ce_appcompat.txt
 
P

Phillip Gawlowski

Has anyone else experienced this? =A0I am running Ruby on Windows XP.
Attached is the crash file. =A0I am hoping this can go into the right
person as this issue halts my progress.

What is the GNU Database Manager thingy that's running on your machine?

My guess is that this thing is loaded into your Ruby process at some
point in time, which results in a crash, since this GNU thing is built
with Microsoft's compiler, and Ruby on Windows is built, well, not
with Microsoft's compiler.

So, can you provide the output of "gem list", and describe exactly (or
at least as exact as you possibly can) what you are doing? And, of
course, any source code that triggers the crash would be helpful as
well. :)

--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
G

Glory L.

Thanks for the prompt response.

Since I never got this problem with SQLite3 there may be something with
Mongoid, BSON_ext, or MongoDB. I got the MongoDB binaries so are you
suggesting I compile the source on my Windows box?

Here's my gem list.

This is my gem list.

abstract (1.0.0)
actionmailer (3.0.7, 3.0.0)
actionpack (3.0.7, 3.0.0)
activemodel (3.0.7, 3.0.0)
activerecord (3.0.7, 3.0.0)
activeresource (3.0.7, 3.0.0)
activesupport (3.0.7, 3.0.0)
arel (2.0.9, 1.0.1)
babosa (0.3.3, 0.2.0)
bcrypt-ruby (2.1.4 x86-mingw32)
bson (1.3.1, 1.3.0)
bson_ext (1.3.1, 1.3.0)
builder (2.1.2)
bundler (1.0.12)
cancan (1.6.4)
carrierwave (0.5.3)
chunky_png (1.2.0, 1.1.1)
compass (0.11.1)
decent_exposure (1.0.1)
devise (1.3.4, 1.3.3, 1.1.3)
devise_invitable (0.4.2)
diff-lcs (1.1.2)
erubis (2.6.6)
factory_girl (1.3.3)
factory_girl_rails (1.0.1)
formtastic (1.2.3)
friendly_id (3.2.1.1, 3.1.7)
fssm (0.2.7)
haml (3.1.1)
haml-rails (0.3.4)
hpricot (0.8.4)
i18n (0.5.0, 0.4.1)
mail (2.2.19, 2.2.17, 2.2.6.1)
mime-types (1.16)
mini_magick (3.2.1)
minitest (1.6.0)
mocha (0.9.12)
mongo (1.3.1, 1.3.0)
mongo_ext (0.19.3)
mongoid (2.0.1)
nokogiri (1.4.4.1 x86-mingw32)
orm_adapter (0.0.5, 0.0.4)
polyglot (0.3.1)
rack (1.2.2, 1.2.1)
rack-mount (0.6.14, 0.6.13)
rack-test (0.5.7, 0.5.6)
rails (3.0.7, 3.0.0)
railties (3.0.7, 3.0.0)
rake (0.8.7)
rdoc (2.5.8)
rspec (2.5.0)
rspec-core (2.5.2)
rspec-expectations (2.5.0)
rspec-mocks (2.5.0)
rspec-rails (2.5.0)
ruby_parser (2.0.6)
rubygems-update (1.6.2)
sass (3.1.1)
sexp_processor (3.0.5)
sqlite3 (1.3.3 x86-mingw32)
sqlite3-ruby (1.3.1 x86-mingw32)
subexec (0.0.4)
thor (0.14.6, 0.14.2)
treetop (1.4.9, 1.4.8)
tzinfo (0.3.27, 0.3.26, 0.3.23)
warden (1.0.4, 1.0.3, 0.10.7)
webrat (0.7.3)
will_paginate (3.0.pre2)

I just create a rails app with this Windows template

https://github.com/glorylo/Rails-3-Windows-Application-Template

* Requires Git Windows installed and simply run this under windows CMD
instead of Cygwin (since I did not install git on Cygwin)

Application uses Mongoid, Haml, and other gems. Create a model with a
few fields and simple go to the resource such as
http://localhost:3000/mymodel/new and submit the form.

Very frequently this crashes. There is no errors on on development log
and Ruby.exe crashes with Microsoft pop-up suggesting I send crash log
(see above for attachment).
 
P

Phillip Gawlowski

Thanks for the prompt response.

Since I never got this problem with SQLite3 there may be something with
Mongoid, BSON_ext, or MongoDB. =A0I got the MongoDB binaries so are you
suggesting I compile the source on my Windows box?

In my short exploration of using Rails 3 with MongoDB on Windows, I
didn't experience any crash under similar circumstances to yours.

I have bson_ext installed, but I *also* have the Ruby DevKit
installed, which allows compilation of (a lot of) gems requiring C
extensions.

It is possible, though I don't know for sure, that the version of
bson_ext you end up with is built with the Microsoft Visual C++
compiler, thus causing Ruby to crash.

Try installing bson_ext with the DevKit installed:
http://rubyinstaller.org/add-ons/devkit/

Don't worry, it takes care of setting up the necessary build tools,
and gets loaded on demand. :)

--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
L

Luis Lavena

Thanks for the prompt response.

Since I never got this problem with SQLite3 there may be something with
Mongoid, BSON_ext, or MongoDB.  I got the MongoDB binaries so are you
suggesting I compile the source on my Windows box?

Here's my gem list.

I don't see nothing strange in your gem list, bson_ext has a fallback
to use pure-ruby code in case no compiler is detected.
Application uses Mongoid, Haml, and other gems.  Create a model with a
few fields and simple go to the resource such ashttp://localhost:3000/mymodel/newand submit the form.

Very frequently this crashes.  There is no errors on on development log
and Ruby.exe crashes with Microsoft pop-up suggesting I send crash log
(see above for attachment).

Are you starting the rails server from the console?

Can you provide us what is the last sentences before the crash?

Normally Ruby will print out the offending line that triggered the
crash before terminating itself.

If you're not starting the ruby.exe process from console, what are you
using instead?
 
G

Glory L.

Luis Lavena wrote in post #998653:
I don't see nothing strange in your gem list, bson_ext has a fallback
to use pure-ruby code in case no compiler is detected.

ashttp://localhost:3000/mymodel/newand submit the form.

Are you starting the rails server from the console?


Yes, the crash still occurs. I did install Devkit with my rails so I
don't think that is the culprit.

Anyhow, I start my rails app with 'rails s' (the standard affair).
Can you provide us what is the last sentences before the crash?

I get this pop with the following:
ruby.exe has encountered a problem and needs to be close. We are sorry
for the inconvenience.

If you are in the middle of something, the information you were working
on might be lost.

Please tell Microsoft about this problem.
We have created an error report that you can send to us. We will treat
this report as confidential and anonymous.


Details:
AppName: ruby.exe AppVer: 1.9.2.180 ModName: msvcrt-ruby191.dll
ModVer: 1.9.2.180 Offset: 0011a00e
Normally Ruby will print out the offending line that triggered the
crash before terminating itself.

There is nothing printed in the development log (i.e. there is no stack
trace shown through 'rails server') so where do I go about culprit line?

I am trying to get a simple app to test with carrierwave (File uploads)
and using Mongoid's Grid FS. Submitting the form often crashes it

Simple Model

class Video
include Mongoid::Document
field :name
field :url
field :description
mount_uploader :image, ImageUploader

validates_presence_of :name

end


---
Uploader

class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :grid_fs

def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
end

----
Form

%h2 Form

= form_for(@video, :html => { :multipart => true }) do |f|
- if @video.errors.any?
#error_explanation
%h2= pluralize(@video.errors.count, "error") |
prohibited this thing from being saved:

%ul
- @video.errors.full_messages.each do |msg|
%li= msg

= f.label :name, "Name"
= f.text_field :name
%br

= f.label :url, "Link Url"
= f.text_field :url
%br
= f.label :description, "Description"
%br
= f.text_area :description
%br

= f.label :image
= f.file_field :image


.actions
= f.submit
 
G

Glory L.

Luis Lavena wrote in post #999023:
I didn't ask the popup information, perhaps wasn't clear but I'm
interested in the output at the console before the crash.


The console, not the log file.

If you don't mind, please create a sample application, outside your
existing one that present this behavior and upload it to github, that
will be more easy than copy and paste your entire source code from
here and will provide a reproducible environment for us to help you
better.

You can upload the source code to GitHub for free.

OK guys here it is. I am still very new to all this and I wish things
would work right out of the box easier. Sigh.

Anyhow, the console logs just shows the html templates being rendered
and then crashing with no other messages.

Simple app created to show crashing:

Simply doing http://localhost:3000/videos/new very often crashes my
machine. No need to submit anything.

Clone and bundle install this. I have MongoDB running as a service on
Windows.

Created repository.

https://github.com/glorylo/crash
https://[email protected]/glorylo/crash.git

I suspect there might be some oddity in the setup but nothing obvious is
screaming at me on this. There may be something stupidly done here but
still I wish Ruby was more graceful and handle errors better.

Let me know if you can reproduce this.
 
P

Phillip Gawlowski

P

Phillip Gawlowski

OK guys here it is. =A0I am still very new to all this and I wish things
would work right out of the box easier. =A0Sigh.

Anyhow, the console logs just shows the html templates being rendered
and then crashing with no other messages.

Simple app created to show crashing:

Simply doing http://localhost:3000/videos/new very often crashes my
machine. =A0No need to submit anything.

There are no routes matching /video in this test app, nor are there
any controllers, models or views beyond what Rails' setup dumps in the
file system.

So, please, provide some *minimal* code to get working, so we might
reproduce the crash. Just update your git repository, and we can git
pull the changes. :)
I suspect there might be some oddity in the setup but nothing obvious is
screaming at me on this. =A0There may be something stupidly done here but
still I wish Ruby was more graceful and handle errors better.

A segmentation fault isn't under Ruby's control, and usually a result
of misbehaving C code.

--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
G

Glory L.

Phillip Gawlowski wrote in post #999137:

Thanks Phillip.

I just tried to clone. There should be those files as well, I did
resources :videos in the routes.rb file. It might have been a timing
issue as I forgot to add some files and you cloned it then. I am
leaning towards something odd with this example as I now got a simple
file upload running with Mongoid but the crash example is something I
cannot pinpoint.
 
P

Phillip Gawlowski

Phillip Gawlowski wrote in post #999137:

Thanks Phillip.

I just tried to clone. =A0There should be those files as well, I did
resources :videos in the routes.rb file. =A0It might have been a timing
issue as I forgot to add some files and you cloned it then.

Indeed. An update made the source work. :)
I am
leaning towards something odd with this example as I now got a simple
file upload running with Mongoid but the crash example is something I
cannot pinpoint.

Yes, unfortunately(?), I cannot reproduce the crash here, either,
despite throwing the largest image file I had into the upload field.

Though, what might hep us is if you grab Visual Studio C++ Express[1]
(it's free, but requires registration after 30 days). This *should*
includes a debugger which able to hook into a crashed Ruby process (I
can't test that assumption since I have a Visual Studio Pro
installation and they can't quite exist side-by-side, alas). That way,
you can at least get a stack trace for us, in case this happens again
with your actual Rails app.

[1] http://www.microsoft.com/express/Downloads/

Alternatively, you can try to install the gems you need via plain old
RubyGems instead of Bundler, since Bundler doesn't appear to pick up
the DevKit and its compiler package.

--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
G

Glory L.

It is too bad the problem is isolated to my machine :( It crashes
rather easily with simply going to form page.. no need to submit
anything.
Alternatively, you can try to install the gems you need via plain old
RubyGems instead of Bundler, since Bundler doesn't appear to pick up
the DevKit and its compiler package.

I'll install VC++ express kit as a last resort if I come across this
again. It seems the Ruby community is developed largely on Mac/linux
and I wonder if I should get myself a Mac to avoid some of the hurdles I
already have to jump through with Cygwin, MYSGit, etc.

Thanks for your time, Phillip.
 
L

Luis Lavena

Yes, unfortunately(?), I cannot reproduce the crash here, either,
despite throwing the largest image file I had into the upload field.

I was not able either.
Though, what might hep us is if you grab Visual Studio C++ Express[1]
(it's free, but requires registration after 30 days). This *should*
includes a debugger which able to hook into a crashed Ruby process (I
can't test that assumption since I have a Visual Studio Pro
installation and they can't quite exist side-by-side, alas). That way,
you can at least get a stack trace for us, in case this happens again
with your actual Rails app.

[1]http://www.microsoft.com/express/Downloads/

I would recommend start the server using GDB, which is part of the
DevKit instead of making the user jump into the daunting task of
building Ruby from source completely.

On the command line, locate wheer you installed the DevKit and do:

C:\Path\to\DevKit\devkitvars.bat

That will make GCC and friends available, including GDB

Then, CD into your application directory and do:

gdb ruby.exe

Which will load Ruby inside GDB, from there:

run -S rails server

Which will run ruby inside GDB, a little bit slower but similar to
doing from the command line.

When the exception occurs, GDB will show that the execution halted
with a SEGFAULT or SEGV exception and will allow you capture the
backtrace, just do "bt" and will obtain a list of the C part of Ruby
that crashed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top