# Mysql connection goe away

**URL:** <https://www.ruby-forum.com/t/mysql-connection-goe-away/134432>\
**Category:** Rails\
**Created:** [April 10, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/mysql-connection-goe-away/134432 "2008-04-10T19:11:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![slonghurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@slonghurst](https://www.ruby-forum.com/u/slonghurst)\
**Post date:** [April 10, 2008, 7:11pm UTC](https://www.ruby-forum.com/t/mysql-connection-goe-away/134432/1 "2008-04-10T19:11:34Z")

</div>

We are currntly running

mongrel v 1.1.4  
mongrel\_cluster 1.0.5  
mysql gem 2.7.5 (built from source)  
rails 2.0.2  
ruby 1.8.6

mysql version 4.1 this is run on a remote server.

We are consistently getting

“ActiveRecord::StatementInvalid (Mysql::Error: MySQL server has gone  
away: SELECT \* FROM…”

errors.

When i then try and stop mongrel some (various) of the mongrels are in  
error state and refuse to do anything, they do not log any errors. I  
cannot stop or restart them and end up having to kill all the processes,  
delete the pids and then start them again, where by they are fine for a  
couple of hours. It seems to happen aftera period of in activity.

We have set

ActiveRecord::Base.verification\_timeout = 14400  
mysql timeout is 28800

I am at a loss now as to what i can do to fix the issue. It is not  
possible for me to update mysql so this is not an option.

Any idea’s?

---

<div class="post-metadata">

**Author:** ![slonghurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@slonghurst](https://www.ruby-forum.com/u/slonghurst)\
**Post date:** [April 10, 2008, 7:12pm UTC](https://www.ruby-forum.com/t/mysql-connection-goe-away/134432/2 "2008-04-10T19:12:36Z")

</div>

error is “mysql connection gone away”

---

<div class="post-metadata">

**Author:** ![slonghurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@slonghurst](https://www.ruby-forum.com/u/slonghurst)\
**Post date:** [April 10, 2008, 8:17pm UTC](https://www.ruby-forum.com/t/mysql-connection-goe-away/134432/3 "2008-04-10T20:17:31Z")

</div>

we also get lots of

“ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to MySQL  
server during query: SELECT \* …”

---

<div class="post-metadata">

**Author:** ![slonghurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@slonghurst](https://www.ruby-forum.com/u/slonghurst)\
**Post date:** [April 10, 2008, 8:23pm UTC](https://www.ruby-forum.com/t/mysql-connection-goe-away/134432/4 "2008-04-10T20:23:48Z")

</div>

On 10 Apr 2008, at 19:17, Shaun Longhurst wrote:

> we also get lots of
> 
> “ActiveRecord::StatementInvalid (Mysql::Error: Lost connection to  
> MySQL  
> server during query: SELECT \* …”

Is the server crashing/erroring out (anything interesting in the mysql  
connection logs) ?

Fred

---

<div class="post-metadata">

**Author:** ![slonghurst](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@slonghurst](https://www.ruby-forum.com/u/slonghurst)\
**Post date:** [April 10, 2008, 9:52pm UTC](https://www.ruby-forum.com/t/mysql-connection-goe-away/134432/5 "2008-04-10T21:52:15Z")

</div>

Nope nothing on the mysql side. Nothing seems to be logged anywhere  
apart from the activerecord errors.
