You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
do_query implements its own read timeout using rb_wait_for_single_fd,
but blocking operations, like mysql_ping, will still block until the
tcp connection expires if there is a problem (multiple minutes
usually).
ActiveRecord's connection pool makes liberal use of ping, so an
unresponsive mysql server can cause rails apps to hang even if
read_timeout has been configured.
We fix this by using the mysql library's own MYSQL_OPT_READ_TIMEOUT
option. It fixes mysql_ping and seems not to interfere with with
do_query.
I don't think writing a test case for this is practical - it requires
dropping packets to/from the mysql server after establishing the
connection. I've tested it like this manually though and it makes all
your fast fail dreams come true.
0 commit comments