# MySQL gem segfault

**URL:** <https://www.ruby-forum.com/t/mysql-gem-segfault/134962>\
**Category:** Rails\
**Created:** [April 16, 2008, 5:25pm UTC](https://www.ruby-forum.com/t/mysql-gem-segfault/134962 "2008-04-16T17:25:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [April 16, 2008, 5:25pm UTC](https://www.ruby-forum.com/t/mysql-gem-segfault/134962/1 "2008-04-16T17:25:01Z")

</div>

I’m encountering odd behavior. I’m not quite sure where to post this  
so I will try the rails list first. Here is the scenario:

I have MySQL 5.0.51 installed on a Windows 2003 Server machine.  
I have Rails 2.0.2 and Ruby 1.8.6 on the same machine.  
I have installed the 2.7.3 mysql gem.  
My rails server will start up just fine. I can query the database and  
load pages just fine.  
When I come back to work the next morning and try to query the app it  
dies with a segfault.  
The error message complains about line 471 in the mysql.rb

Up until now development was being done on an XP machine using  
Postgres. I just started migration to the new platform and testing  
last week. I’m personally not a fan of MySQL but it looks like that  
might be a necessity.

Memory Leak?  
Has anyone else seen this?  
Does anyone have this same setup working?  
Suggestions?

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [April 16, 2008, 6:19pm UTC](https://www.ruby-forum.com/t/mysql-gem-segfault/134962/2 "2008-04-16T18:19:53Z")

</div>

Glen wrote:

> I’m encountering odd behavior. I’m not quite sure where to post this  
> so I will try the rails list first. Here is the scenario:
> 
> I have MySQL 5.0.51 installed on a Windows 2003 Server machine.  
> I have Rails 2.0.2 and Ruby 1.8.6 on the same machine.  
> I have installed the 2.7.3 mysql gem.  
> My rails server will start up just fine. I can query the database and  
> load pages just fine.  
> When I come back to work the next morning and try to query the app it  
> dies with a segfault.  
> The error message complains about line 471 in the mysql.rb
> 
> Up until now development was being done on an XP machine using  
> Postgres. I just started migration to the new platform and testing  
> last week. I’m personally not a fan of MySQL but it looks like that  
> might be a necessity.
> 
> Memory Leak?  
> Has anyone else seen this?  
> Does anyone have this same setup working?  
> Suggestions?

Seems to work for me similar setup. What is on line 471? One thing to  
be aware of is dropped connections every 6 hours or so, though you can  
overcome that and it’s usually graceful [google for rails restart mysql  
connection might help]

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [April 17, 2008, 2:31am UTC](https://www.ruby-forum.com/t/mysql-gem-segfault/134962/3 "2008-04-17T02:31:36Z")

</div>

I was mistaken it is complaining about line 471 in mysql\_adapter.rb:

@connection.real\_connect(\*@connection\_options)

This line is in the connect method.

I found people suggesting that ActiveRecord::Base.verification\_timeout  
should be changed but they neglected to say where would be the best  
place to do that. I would assume environment.rb but am not positive.

Broken default behavior seems odd is this a problem with MySQL or the  
gem?

On Apr 16, 10:19 am, Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Glen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/8c91f0/32.png) [@Glen](https://www.ruby-forum.com/u/Glen)\
**Post date:** [April 17, 2008, 2:39am UTC](https://www.ruby-forum.com/t/mysql-gem-segfault/134962/4 "2008-04-17T02:39:13Z")

</div>

Glen wrote:

> I was mistaken it is complaining about line 471 in mysql\_adapter.rb:
> 
> @connection.real\_connect(\*@connection\_options)
> 
> This line is in the connect method.
> 
> I found people suggesting that ActiveRecord::Base.verification\_timeout  
> should be changed but they neglected to say where would be the best  
> place to do that. I would assume environment.rb but am not positive.
> 
> Broken default behavior seems odd is this a problem with MySQL or the  
> gem?
> 
> On Apr 16, 10:19 am, Roger P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> Seems odd that it would be running real\_connect “again” – like it’s  
> trying to reconnect or something.  
> Maybe it’s a problem with the gem not re-connecting right?  
> Googling for mysql gem segfault seems to reveal some concerns over time  
> with it, and maybe fixes.  
> GL.  
> -R
