Rails-talk,
Last night I got a slew (around 2000) of these exceptions raised in my
production app between 4:03 AM and 7:30 AM (eastern time).
They all had the same pattern:
ActiveRecord::StatementInvalid: Mysql2::Error: This connection is still
waiting for a result, try again once you have the result: SELECT
spree_buckets
.* FROM spree_buckets
WHERE spree_buckets
.slug
=
‘gallery’ LIMIT 1
(The SQL query was different for many, but the Mysql2::Error: This
connection is still waiting for a result, try again once you have the
result part was the same)
I called Amazon RDS support and they said the underlying database looked
fine, we are well below our IOPS threshold, and our queue depth looks
healthy.
I think perhaps just 1 Unicorn worker choked up with a single MySQL
call, resulting in all subsequent calls from that Unicorn worker to
produce this error (for 3 hours!)
Does anyone else have any best practice advice for this error? Should I
simply catch for this exception and close & reconnect any active MySQL
connections ? Can someone share some examples of how to do that as
cleanly as possible?
Thanks,
Jason
Jason Fleetwood-Boldt
[email protected]