mysql2 icon indicating copy to clipboard operation
mysql2 copied to clipboard

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

Open voxik opened this issue 1 year ago • 1 comments

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:

https://github.com/brianmario/mysql2/blob/a2873cdaa8516d6049ca9c69018c2d6b32989539/spec/mysql2/client_spec.rb#L711-L737

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.

voxik avatar Nov 26 '24 10:11 voxik

This should be resolved on Fedora by building mariadb-connector-c with -DDEFAULT_SSL_VERIFY_SERVER_CERT=OFF option. More details here. However, it is likely not permanent measure. Not sure 🤷

voxik avatar Feb 05 '25 21:02 voxik