# Mongrels Hanging in mysql\_adapter.rb

**URL:** <https://www.ruby-forum.com/t/mongrels-hanging-in-mysql-adapter-rb/182328>\
**Category:** Mongrel\
**Created:** [January 26, 2010, 5:11pm UTC](https://www.ruby-forum.com/t/mongrels-hanging-in-mysql-adapter-rb/182328 "2010-01-26T17:11:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![serty2\_serty2](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/cdc98d/32.png) [@serty2\_serty2](https://www.ruby-forum.com/u/serty2_serty2)\
**Post date:** [January 26, 2010, 5:11pm UTC](https://www.ruby-forum.com/t/mongrels-hanging-in-mysql-adapter-rb/182328/1 "2010-01-26T17:11:25Z")

</div>

Hi everyone,

I have been trying to solve this problem for quite some time now and I  
really don’t have any further clue to investigate.

I am running a mongrel\_cluster 1.0.5-2 (mongrel verison : 1.1.5-5) on a  
ubuntu box with apache2 2.2.12-1ubuntu2.1

I have 4 different apps on the same box and each app has two mongrel  
instances.

After a short period of time ( \< 2 hours ) some of the 8 mongrel  
instances  
just stop responding.

I read the mongrel FAQ and tried to  
set ActiveRecord::Base.verification\_timeout = 14400 (the mysql parameter  
is  
set to the default 28800) in myapp/config/environments/production.rb

The problem kept happening.

I decided to lower that number, making it 60.  
No more success.

I installed gdb and the ruby macros to make sure i was in the mysql  
driver  
while hanging and sure enough, here is the top of the BT from GDB :

/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:264:in  
`active?'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:136:in`verify!’",  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:256:in  
`checkout_and_verify'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:252:in`checkout\_existing\_connection’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:186:in  
`checkout'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in`loop’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:184:in  
`checkout'", "/usr/lib/ruby/1.8/monitor.rb:242:in`synchronize’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:183:in  
`checkout'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in`connection’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/abstract/connection\_pool.rb:326:in  
`retrieve_connection'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:121:in`retrieve\_connection’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:113:in  
`connection'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2934:in`quoted\_table\_name’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/base.rb:1626:in  
`construct_finder_sql'", "/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1490:in`find\_every’”,  
“/var/lib/gems/1.8/gems/activerecord-2.2.2/lib/active\_record/base.rb:589:in  
`find’”,

I figured that since I was running a packaged version of mongrel\_cluster  
(not the gem installed one), I should use the package version of mysql  
driver for ruby.  
So i did  
gem uninstall mysql

and installed :  
apt-get install libmysql-ruby1.8

I then restarted the mongrels and sure enough after 1h25 one of them was  
hanging in the mysql\_adapter.rb, showing the same backtrace as before.

I really am out of clue here and any advice / help would be much  
appreciated.

I have to note that I am far from being an ROR guru and maybe the  
solution  
to my problem is simpler than what I have been looking for, but I just  
don’t  
know where to look anymore.

Thanks for any advice / answer

Damien
