30. activerecord-mysql-reconnect
Started GET "/items" for 127.0.0.1 at 2014-07-10 13:18:08 +0000
Processing by ItemsController#index as */*
Rendered items/index.html.erb within layouts/application (0.3ms)
Completed 200 OK in 3.2ms (Views: 1.8ms | ActiveRecord: 0.6ms)
Started GET "/items" for 127.0.0.1 at 2014-07-10 13:18:08 +0000
MySQL server has gone away. Trying to reconnect in 1.5 seconds. (cause: Access denied for user 'scott'@'dagon'
(using password: YES) [Mysql2::Error], connection: host=192.168.100.100;database=hello;username=scott)
Started GET "/items" for 127.0.0.1 at 2014-07-10 13:18:08 +0000
MySQL server has gone away. Trying to reconnect in 1.5 seconds. (cause: Access denied for user 'scott'@'dagon'
(using password: YES) [Mysql2::Error], connection: host=192.168.100.100;database=hello;username=scott)
MySQL server has gone away. Trying to reconnect in 3.0 seconds. (cause: Access denied for user 'scott'@'dagon'
(using password: YES) [Mysql2::Error], connection: host=192.168.100.100;database=hello;username=scott)
MySQL server has gone away. Trying to reconnect in 3.0 seconds. (cause: Access denied for user 'scott'@'dagon'
(using password: YES) [Mysql2::Error], connection: host=192.168.100.100;database=hello;username=scott)
Processing by ItemsController#index as */*
Rendered items/index.html.erb within layouts/application (0.4ms)
Completed 200 OK in 3.5ms (Views: 1.9ms | ActiveRecord: 0.9ms)
37. 再接続モード
● :r (読み込み)
○ SELECT / SHOW / SET をリトライ
● :rw(読み書き)
○ 「Lost connection to server during query」以外の
クエリをリトライ
● :force(全部)
○ すべてのSQLをリトライします
38. Lost connection to server during query
http://dev.mysql.com/doc/refman/5.5/en/gone-away.html
CR_SERVER_LOST
The client didn't get an error when writing to the
server, but it didn't get a full answer (or any
answer) to the question.
40. Lost connection to server during query
mysql2をいじる…
● mysql_send_queryと
mysql_read_query_resultの間にsleepを入れる
● クライアントからクエリを投げる
● sleepの間にMySQLを再帰起動
● sleepの間にMySQLをkill
● エラーにならない…