Mysql2::Error: Lost connection to MySQL server during query: ...
It occurs in migrations mostly when we are alerting big tables.
I make some investigation and I think the problem is in class Reaper
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb).
Method remove is called (by reap method) during query and we exception (Mysql2::Error: Lost connection to MySQL server during query)
Rails 4, mysql2 gem (This problem not exists in rails 3.2)
If we run
ActiveRecord::Base.connection.execute("LONG RUNNING SQL")
We will get
Mysql2::Error: Lost connection to MySQL server during query: ...
It occurs in migrations mostly when we are alerting big tables.
I make some investigation and I think the problem is in class Reaper
activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb).
Method remove is called (by reap method) during query and we exception (Mysql2::Error: Lost connection to MySQL server during query)
If we add one of this options:
dead_connection_timeout: 10000000
reaping_frequency: 10000000
to database.yml it will solve problem but rails then will be not able to reconnect to database after connection lost.
The text was updated successfully, but these errors were encountered: