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
While looking into making mysql2 support non-integer timeouts, @pushrax and I found a bug in the client.
There is a specific edge case where neither the do_query file descriptor timeout nor the MYSQL_OPT_READ_TIMEOUT apply.
The error can be reproduced by running a query that responds quickly with the first reply but fills the query response buffer, therefore taking a while to read.
As you can see from the run below, this causes the query the run successfully, despite going over the 1 second read timeout time.
Instructions to reproduce
Set the client configuration in the following test and run it.
it"timeout overflow buffer timeout edge case"doclient=Mysql2::Client.new(host: '<insert>',port: '<insert>',username: '<insert>',database: '<insert>',connect_timeout: 1,read_timeout: 1,write_timeout: 1,)client.query("CREATE TABLE IF NOT EXISTS test_table (c1 MEDIUMTEXT, c2 MEDIUMTEXT)")s=StringIO.new1500.times{s << "sdjsdjsdjssadaskdhasfhasjdhaskdjhasdjkhsadjkh"}3000.timesdoclient.query("INSERT INTO test_table (c1, c2) VALUES ('#{s.string}', '#{s.string}')")endstart_time=Time.nowclient.query("SELECT * from test_table")query_time=Time.now - start_timeexpect(query_time).tobe <= 1.0ensureclient.query("DROP TABLE IF EXISTS test_table")end
The result on my local machine:
The text was updated successfully, but these errors were encountered:
While looking into making mysql2 support non-integer timeouts, @pushrax and I found a bug in the client.
There is a specific edge case where neither the do_query file descriptor timeout nor the
MYSQL_OPT_READ_TIMEOUT
apply.The error can be reproduced by running a query that responds quickly with the first reply but fills the query response buffer, therefore taking a while to read.
As you can see from the run below, this causes the query the run successfully, despite going over the 1 second read timeout time.
Instructions to reproduce
Set the client configuration in the following test and run it.
The result on my local machine:

The text was updated successfully, but these errors were encountered: