Segmentation fault from mysql_adapter.rb

Hello, I’m a rails newbie.

I wrote a simple application to navigate between 2 pages. This is my
controller file

class SayController < ApplicationController

def hello
end

def gudbye
end

end

I have 2 rhtml files in views/say folder hello.rhtml & gudbye.rhtml

hello.rhtml contains a line <%= link_to “Logout”, :action => “gudbye”
%>

Similarly, gudbye.rhtml contains <%= link_to “Go Back”, :action=>
“hello” %>

Then,

demo>ruby script/server
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server

This much is working fine.
When I go to http://localhost:3000/say/hello in browser, my hello page
is getting displayed.

The problem is that at random times, I get a segmentation fault, when
I click the link (to either hello or gudbye page)

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/ lib/ active_record/
connection_adapters/ mysql_adapter.rb:202: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-mswin32]

This application has requested the Runtime to terminate it in an
unusual way.

Please contact the application’s support team for more information.

demo>

This happens only at random times, sometimes the two links work fine,
sometimes it do not.

Can some one please help me.

I’m getting this error message as well every morning when I’m back at
work. I suppose monit could be of help here if I wasn’t running in a
Windows environment.

/Nicklas

Divya M. wrote:

The problem is that at random times, I get a segmentation fault, when
I click the link (to either hello or gudbye page)

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/ lib/ active_record/
connection_adapters/ mysql_adapter.rb:202: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-mswin32]

This application has requested the Runtime to terminate it in an
unusual way.

Please contact the application’s support team for more information.

demo>

This happens only at random times, sometimes the two links work fine,
sometimes it do not.

Can some one please help me.

Solved in any way!? I got the same problem…

On Mar 30, 11:17 am, Nicklas H. [email protected]

Do you guys think that is a webserver problem? I mean switching from
webrick to something else … would I solve it?

On Apr 17, 10:00 am, Divya M. [email protected]

Not yet solved. :frowning:

adedip wrote:

Do you guys think that is a webserver problem? I mean switching from
webrick to something else … would I solve it?

On Apr 17, 10:00�am, Divya M. [email protected]

I am using Mongrel, so switching to that won’t help. This is totaly
driving me crazy.

Im having the same problem too, im getting it on that tutorial for
creating your own blog, when I try and submit the form the ruby server
crashes and I get the same error.

MYSQL Problem?

On Apr 20, 10:36 am, Nicklas H. [email protected]

There is really easy way to test if it’s a time out issue. Simply
create a action in your controller that queries the database.
Something as simple as User.find(:first). Setup a cron on either your
server or local maching to call that method (ie curl mystite.com/
active ) once a minute or whatever your connection timeout is set in
mysql. Wake up tomorrow, if you see an error.

Other stuff to look into:
Double check that mysql gem is installed.
Check your mysql timeout:

Really version 2+ of rails shouldn’t really have this problem

On Apr 21, 2:19 am, Nicklas H. [email protected]

Drew wrote:

Im having the same problem too, im getting it on that tutorial for
creating your own blog, when I try and submit the form the ruby server
crashes and I get the same error.

MYSQL Problem?

On Apr 20, 10:36�am, Nicklas H. [email protected]

Could it be some kind of timeout between MySQL and web server?

Divya M. wrote:

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/ lib/ active_record/
connection_adapters/ mysql_adapter.rb:202: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-mswin32]

This application has requested the Runtime to terminate it in an
unusual way.

Please contact the application’s support team for more information.

demo>

I am getting this same problem. I am getting it after setting up a new
dev environment on a windows machine. I first saw it in RubyMine (IDE),
when I went to the Tools->Rake Tasks->db->create->all command. I got
this as the output:

C:\Ruby\bin\ruby.exe -e
STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) C:\Ruby\bin/rake
db:create:all
(in H:/projects/DMS)
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/mysql_adapter.rb:202:
[BUG] Segmentation fault
ruby 1.8.6 (2008-08-11) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application’s support team for more information.

Process finished with exit code 3

What version of MySQL is everybody (that is having this problem)
running?

I tried upgrading to 5.1 a while back and couldn’t get Rails
(ActiveRecord) to even work with it.
I downgraded back to 5.0.x and everything worked fine again. I haven’t
tried going to 5.1 again.

On May 4, 9:16 am, “Gregg H.” [email protected]

E. Litwin wrote:

What version of MySQL is everybody (that is having this problem)
running?

I tried upgrading to 5.1 a while back and couldn’t get Rails
(ActiveRecord) to even work with it.
I downgraded back to 5.0.x and everything worked fine again. I haven’t
tried going to 5.1 again.

On May 4, 9:16�am, “Gregg H.” [email protected]

I am running the latest 5.1 downloaded from
http://dev.mysql.com/downloads/mysql/5.1.html#downloads

The strange thing is using the rake task for drop all works. And just
as another sidenote, the create all task that seg faults for me does
actually make the databases. I just dont know where it dies.

Gregg H. wrote:

I am also getting this, which I believe is related to the same problem:

== InitialStructureAndData: migrating

– create_table(“areas”, {:force=>true})
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `each’ for #Mysql:0x4007ff4

(See full trace by running task with --trace)

Fixed the problem. This solves both of my errors:

http://forums.aptana.com/viewtopic.php?f=20&t=7563&p=27407&hilit=libmysql.dll#p27407

I am also getting this, which I believe is related to the same problem:

== InitialStructureAndData: migrating

– create_table(“areas”, {:force=>true})
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `each’ for #Mysql:0x4007ff4

(See full trace by running task with --trace)

The help at the aptana site fixed both my strange problems. Thanks so
much. I was looking into changing to Mongrel/Apache to fix them.

One problem was when doing a find method on an ActiveRecord , ie
Contact.find(1), it would get a seg fault . Contact.save would work
fine and everything was getting to the MySQL db when I used ruby
console. I’m working my way through the Ruby on Rails Bible by
Timothy Fisher and it was very frustrating when simple examples did
not work but enough worked that I didn’t suspect my installation.

The solution from the aptera site was to install a MySQL 5.0 dll
( libmsql.dll )in place of the 5.1 one. When I looked in the ruby/bin
directory it wasn’t even there. Copying that file over (and
restarting webrick, MySQL server & console) did the trick. I thought
I had installed the mysql gem but I’m new to RoR so I certainly could
have messed up somewhere. It also fixed my strange problem where
trying to view
pages would crash Webrick.

I am using MySQL 5.0 but I do have 5.1 installed.

On May 7, 1:58 pm, “Gregg H.” [email protected]

Divya M. wrote:

Not yet solved. :frowning:

I had a simular problem (i am also newbie)
for me it was solved by adding “host: localhost” in the
config/database.yml file

Hope it can help some others to…

grtz,
patrick