mysql2: tests failing with mariadb10.5: Mysql2::Statement

Failures:

  1) Mysql2::Error encoding returns error messages as UTF-8 by default
     Failure/Error: expect(bad_err.message).to include("??}\u001F")
       expected "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '??}\\001F' at line 1" to include "??}\u001F"
     # ./spec/mysql2/error_spec.rb:59:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:17:in `with_internal_encoding'
     # ./spec/mysql2/error_spec.rb:52:in `block (3 levels) in <top (required)>'

  2) Mysql2::Statement should create a statement
     Failure/Error: expect { statement = @client.prepare 'SELECT 1' }.to change(&method(:stmt_count)).by(1)
       expected result to have changed by 1, but was changed by 0
     # ./spec/mysql2/statement_spec.rb:18:in `block (2 levels) in <top (required)>'

  3) Mysql2::Statement close should free server resources
     Failure/Error: expect { stmt.close }.to change(&method(:stmt_count)).by(-1)
       expected result to have changed by -1, but was changed by 0
     # ./spec/mysql2/statement_spec.rb:702:in `block (3 levels) in <top (required)>'

Finished in 11.72 seconds (files took 0.21288 seconds to load)
322 examples, 3 failures

Failed examples:

rspec ./spec/mysql2/error_spec.rb:51 # Mysql2::Error encoding returns error messages as UTF-8 by default
rspec ./spec/mysql2/statement_spec.rb:16 # Mysql2::Statement should create a statement
rspec ./spec/mysql2/statement_spec.rb:699 # Mysql2::Statement close should free server resources

As those tests are old and simple I do not have a clue what is causing this. Exactly same code builds / passes tests in our Fedora Stable (mariadb: 10.4.17).

The change may have been caused by update to openssl version: 1.1.1i (According to one of our tools, which might be wrong.)


Ruby version: both 2.7 and 3.0 are failing mariadb-server version: 10.5.8 gem version: 0.5.3

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

You can see the reproducer on the following CI cases in GitHub Actions now.

I can confirm that with MariaDB 10.4, the test suite passes, because it triggers the rescue branch:

https://github.com/brianmario/mysql2/blob/ad94a7956ec7de1ee5ec0f84d2577361227c24ac/spec/mysql2/statement_spec.rb#L8-L14

while for the MariaDB 10.5.8, the query succeeds, but returns unexpected result. I am not sure if the difference to MySql is intentional or if that is bug on MariaDB side.