Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


mysql2 3.12 and Active Record mysql2 incompatibility #11457

simi opened this Issue · 7 comments

3 participants

Josef Šimánek Toshinori Kajihara Yves Senn
Josef Šimánek

This commit brianmario/mysql2@82aa624 broke CI mysql2 tests.

Introduced in this Travis job first

/cc @guilleiguaran @senny

Toshinori Kajihara

mysql2 0.3.12 starts to support :read_timeout / :write_timeout options.
Should we assign default value to read_timeout/write_timeout options to fix this ? For example:

in lib/active_record/connection_adapters/mysql2_adapter.rb

 12       config[:username] = 'root' if config[:username].nil?
 14       config[:read_timeout]  = 600 if config[:read_timeout].nil? ★
 15       config[:write_timeout] =  60 if config[:write_timeout].nil? ★
 17       if Mysql2::Client.const_defined? :FOUND_ROWS
 18         config[:flags] = Mysql2::Client::FOUND_ROWS
 19       end

This patch fixes this issue.

BTW: I don't think the above commit break CI mysql2 tests, but we are drowned in many warning message sea.

Yves Senn

@kennyj yea the sea of warnings could cause travis to shut down the build.

Josef Šimánek

@kennyj Nice! That works for both 3.11 and 3.12 mysql2 gems.

Question is what are good default values.

But I can't find any hint that this is required config parameter.

Toshinori Kajihara

@simi I'm not sure about good values.

MySQL's connection timeout is 28800 seconds. It's so long.
According to googling, LVS(linux virtual server)'s default timeout is 900 seconds. So I wrote 600 (less than 900) seconds in the above fix.

Josef Šimánek

@kennyj I'm getting deeper into mysql2. I think this is not proper solution.

Josef Šimánek simi referenced this issue in brianmario/mysql2

Initialize read_timeout #400

Josef Šimánek

@kennyj I found it. ^

Toshinori Kajihara

@simi good :)

Josef Šimánek simi referenced this issue from a commit in simi/rails
Josef Šimánek simi Use latest mysql2.
Fixes #11457
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.