Skip to content

Several test errors + test suite getting stuc with mariadb-connector-c 3.4.1 #1382

@voxik

Description

@voxik

I have initially reported this against Fedora, but I'll try my luck here. Running test suite of Mysql 0.5.5, starting with mariadb-connector-c 3.4.1, the test suite gets stuck on two places:

it "should handle Timeouts without leaving the connection hanging if reconnect is true" do
if RUBY_PLATFORM.include?('darwin') && @client.server_info.fetch(:version).start_with?('5.5')
pending('MySQL 5.5 on OSX is afflicted by an unknown bug that breaks this test. See #633 and #634.')
end
client = new_client(reconnect: true)
expect { Timeout.timeout(0.1, ArgumentError) { client.query('SELECT SLEEP(1)') } }.to raise_error(ArgumentError)
expect { client.query('SELECT 1') }.to_not raise_error
end
it "should handle Timeouts without leaving the connection hanging if reconnect is set to true after construction" do
if RUBY_PLATFORM.include?('darwin') && @client.server_info.fetch(:version).start_with?('5.5')
pending('MySQL 5.5 on OSX is afflicted by an unknown bug that breaks this test. See #633 and #634.')
end
client = new_client
expect { Timeout.timeout(0.1, ArgumentError) { client.query('SELECT SLEEP(1)') } }.to raise_error(ArgumentError)
expect { client.query('SELECT 1') }.to raise_error(Mysql2::Error)
client.reconnect = true
expect { Timeout.timeout(0.1, ArgumentError) { client.query('SELECT SLEEP(1)') } }.to raise_error(ArgumentError)
expect { client.query('SELECT 1') }.to_not raise_error
end
end

Interestingly, these two test cases have been disabled on MacOS X for ages. Apart of those, there are addition 4 errors:

Failures:

  1) Mysql2::Client#automatic_close should not close connections when running in a child process
     Failure/Error: expect { client.query('SELECT 1') }.to_not raise_exception
     
       expected no Exception, got #<Mysql2::Error::ConnectionError: TLS/SSL error: decryption failed or bad record mac> with backtrace:
         # ./lib/mysql2/client.rb:151:in 'Mysql2::Client#_query'
         # ./lib/mysql2/client.rb:151:in 'block in Mysql2::Client#query'
         # ./lib/mysql2/client.rb:150:in 'Thread.handle_interrupt'
         # ./lib/mysql2/client.rb:150:in 'Mysql2::Client#query'
         # ./spec/mysql2/client_spec.rb:349:in 'block (4 levels) in <top (required)>'
         # ./spec/mysql2/client_spec.rb:349:in 'block (3 levels) in <top (required)>'
     # ./spec/mysql2/client_spec.rb:349:in 'block (3 levels) in <top (required)>'

  2) Mysql2::Client#query should detect closed connection on query read error
     Failure/Error:
       expect do
         @client.query("SELECT SLEEP(1)")
       end.to raise_error(Mysql2::Error, /Lost connection/)
     
       expected Mysql2::Error with message matching /Lost connection/, got #<Mysql2::Error::ConnectionError: TLS/SSL error: unexpected eof while reading> with backtrace:
         # ./lib/mysql2/client.rb:151:in 'Mysql2::Client#_query'
         # ./lib/mysql2/client.rb:151:in 'block in Mysql2::Client#query'
         # ./lib/mysql2/client.rb:150:in 'Thread.handle_interrupt'
         # ./lib/mysql2/client.rb:150:in 'Mysql2::Client#query'
         # ./spec/mysql2/client_spec.rb:618:in 'block (4 levels) in <top (required)>'
         # ./spec/mysql2/client_spec.rb:619:in 'block (3 levels) in <top (required)>'
     # ./spec/mysql2/client_spec.rb:619:in 'block (3 levels) in <top (required)>'

  3) Mysql2::Client#query should be impervious to connection-corrupting timeouts in #execute
     Failure/Error: expect { @client.query('SELECT 1') }.to_not raise_error
     
       expected no Exception, got #<Mysql2::Error: MySQL client is not connected> with backtrace:
         # ./lib/mysql2/client.rb:151:in 'Mysql2::Client#_query'
         # ./lib/mysql2/client.rb:151:in 'block in Mysql2::Client#query'
         # ./lib/mysql2/client.rb:150:in 'Thread.handle_interrupt'
         # ./lib/mysql2/client.rb:150:in 'Mysql2::Client#query'
         # ./spec/mysql2/client_spec.rb:702:in 'block (4 levels) in <top (required)>'
         # ./spec/mysql2/client_spec.rb:702:in 'block (3 levels) in <top (required)>'
     # ./spec/mysql2/client_spec.rb:702:in 'block (3 levels) in <top (required)>'

  4) Mysql2::Result streaming should raise an exception if streaming ended due to a timeout
     Failure/Error:
       expect do
         res.each_with_index do |_, i|
           # Exhaust the first result packet then trigger a timeout
           sleep 4 if i > 0 && i % 1000 == 0
         end
       end.to raise_error(Mysql2::Error, /Lost connection/)
     
       expected Mysql2::Error with message matching /Lost connection/, got #<Mysql2::Error: TLS/SSL error: unexpected eof while reading> with backtrace:
         # ./spec/mysql2/result_spec.rb:253:in 'Mysql2::Result#each'
         # ./spec/mysql2/result_spec.rb:253:in 'Enumerable#each_with_index'
         # ./spec/mysql2/result_spec.rb:253:in 'block (4 levels) in <top (required)>'
         # ./spec/mysql2/result_spec.rb:257:in 'block (3 levels) in <top (required)>'
     # ./spec/mysql2/result_spec.rb:257:in 'block (3 levels) in <top (required)>'

Finished in 13.01 seconds (files took 0.15137 seconds to load)
338 examples, 4 failures, 4 pending

Failed examples:

rspec ./spec/mysql2/client_spec.rb:334 # Mysql2::Client#automatic_close should not close connections when running in a child process
rspec ./spec/mysql2/client_spec.rb:609 # Mysql2::Client#query should detect closed connection on query read error
rspec ./spec/mysql2/client_spec.rb:695 # Mysql2::Client#query should be impervious to connection-corrupting timeouts in #execute
rspec ./spec/mysql2/result_spec.rb:240 # Mysql2::Result streaming should raise an exception if streaming ended due to a timeout

Can somebody help me to understand why?

BTW there errors reminds me errors I was recently dealing with in PG connector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions