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
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:
to database.yml it will solve problem but rails then will be not able to reconnect to database after connection lost.
Yep! This was recently reverted @ 7150a9d