I am having problems updating my rails 2.3.14 / ruby ββ1.8.7 app to 3.1.1 / 1.9.2: I have
(ActiveRecord::StatementInvalid) "Mysql2::Error: MySQL server has gone away"
errors occur sporadically. The important thing is that I never had such problems with the mysql gem on 2.3.14 and the exact same db (so the error should not come from mysql (v5.5.10)).
Example:
$ rails c production Loading production environment (Rails 3.1.1) ruby-1.9.2-p290 :001 > ActiveRecord::Base.connection.active? => false ruby-1.9.2-p290 :002 > exit $ rails c production Loading production environment (Rails 3.1.1) ruby-1.9.2-p290 :001 > ActiveRecord::Base.connection.active? => true
This only happens with my (remote) production database, no problem with my local db development. I tried setting "reconnect: true" in my .yml database, but this led to
Mysql2::Error: Host '****' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts':...
I tried to isolate the problem with a little rb script by only loading mysql2 and activerecord, but I was not able to reproduce the error in this way (so that it could be associated with the rails stack).
I cannot return from "mysql2" to "mysql" due to encoding problems ( http://www.rorra.com.ar/2010/07/30/rails-3-mysql-and-utf-8/ ) . As a result, I had to roll back my production to my rails 2.3.14 application, which upsets me very much ...
Do you see what I can do to debug this? I canβt even find the right way to reproduce the error ... Has anyone encountered the same error?
I just found a few people mentioning this error (for example: https://github.com/brianmario/mysql2/issues/213 ) but not a solution.
Thanks for your help.
source share