Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

mysql2 3.12 and Active Record mysql2 incompatibility #11457

Closed
simi opened this Issue · 7 comments

3 participants

@simi

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

Introduced in this Travis job first https://travis-ci.org/rails/rails/builds/9117770.

/cc @guilleiguaran @senny

@kennyj
Collaborator

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?
 13
 14       config[:read_timeout]  = 600 if config[:read_timeout].nil? ★
 15       config[:write_timeout] =  60 if config[:write_timeout].nil? ★
 16
 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.

@senny
Owner

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

@simi

@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.

@kennyj
Collaborator

@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.

@simi

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

@simi simi referenced this issue in brianmario/mysql2
Merged

Initialize read_timeout #400

@simi

@kennyj I found it. ^

@kennyj
Collaborator

@simi good :)

@simi simi referenced this issue from a commit in simi/rails
@simi simi Use latest mysql2.
Fixes #11457
d97269d
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.