Bug 2323148 - mariadb-connector-c-3.4.1-1.fc42 make the rubygem-mysql2 test suite to stuck
Summary: mariadb-connector-c-3.4.1-1.fc42 make the rubygem-mysql2 test suite to stuck
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb-connector-c
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Vít Ondruch
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-11-01 13:12 UTC by Vít Ondruch
Modified: 2025-02-13 16:17 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2025-02-13 16:17:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github brianmario mysql2 issues 1382 0 None open Several test errors + test suite getting stuc with mariadb-connector-c 3.4.1 2024-11-26 10:22:05 UTC

Description Vít Ondruch 2024-11-01 13:12:15 UTC
Trying to rebuild rubygem-mysql2 in Rawhide, the test suite gets stuck:

~~~
... snip ...

+ rspec -Ilib:/builddir/build/BUILD/rubygem-mysql2-0.5.5-build/BUILDROOT/usr/lib64/gems/ruby/mysql2-0.5.5 -f d spec
<internal:gc>:286: warning: double_heap is deprecated, please use expand_heap instead

Mysql2::EM::Client
  should support async queries
  should support queries in callbacks
  should not swallow exceptions raised in callbacks
  should not raise error when closing client with no query running
  when an exception is raised by the client
    should swallow exceptions raised in by the client
    should fail the deferrable

Mysql2::Client
  should raise a Mysql::Error::ConnectionError upon connection failure
  should raise an exception on create for invalid encodings
  should raise an exception on non-string encodings
  should not raise an exception on create for a valid encoding
  should accept connect flags and pass them to #connect
  should parse flags array
  should parse flags string
  should default flags to (REMEMBER_OPTIONS, LONG_PASSWORD, LONG_FLAG, TRANSACTIONS, PROTOCOL_41, SECURE_CONNECTION)
  should execute init command
  should send init_command after reconnect
  should have a global default_query_options hash
  should terminate connections when calling close
  should not leave dangling connections after garbage collection
  should be able to connect to database with numeric-only name
  should respond to #close
  should be able to close properly
  should not try to query closed mysql connection
  should respond to #query
  should respond to #warning_count
  should respond to #query_info
  should expect connect_timeout to be a positive integer
  should expect read_timeout to be a positive integer
  should expect write_timeout to be a positive integer
  should allow nil read_timeout
  should set default program_name in connect_attrs (PENDING: DON'T WORRY, THIS TEST PASSES - but PERFORMANCE SCHEMA is not enabled in your MySQL daemon.)
  should set custom connect_attrs (PENDING: DON'T WORRY, THIS TEST PASSES - but PERFORMANCE SCHEMA is not enabled in your MySQL daemon.)
  should respond to #socket
  should respond to escape
  should respond to #escape
  should respond to #info
  #info should return a hash containing the client version ID and String
  should respond to #server_info
  #server_info should return a hash containing the client version ID and String
  #server_info should require an open connection
  should raise a Mysql2::Error::ConnectionError exception upon connection failure due to invalid credentials
  should respond to #thread_id
  #thread_id should be a Fixnum
  should respond to #ping
  #thread_id should return a boolean
  should be able to connect using plaintext password
  should respond to #encoding
  using defaults file
    should not raise an exception for valid defaults group
    should not raise an exception without default group
  SSL
    should set ssl_mode option disabled
    should set ssl_mode option required
    should set ssl_mode option verify_identity
    should be able to connect via SSL options
  #set_server_option
    returns true when multi_statements is enable
    returns true when multi_statements is disable
    returns false when multi_statements is neither OPTION_MULTI_STATEMENTS_OFF or OPTION_MULTI_STATEMENTS_ON
    enables multiple-statement
    disables multiple-statement
  #automatic_close
    is enabled by default
    can be configured
    can be assigned
    should not close connections when running in a child process (FAILED - 1)
  #closed?
    should return false when connected
    should return true after close
  #warning_count
    when no warnings
      should 0
    when has a warnings
      should > 0
  #query_info
    when no info present
      should 0
    when has some info
      should retrieve it
  :local_infile
    should raise an error when local_infile is disabled
    should raise an error when a non-existent file is loaded
    should LOAD DATA LOCAL INFILE
  #query
    should let you query again if iterating is finished when streaming
    should not let you query again if iterating is not finished when streaming
    should only accept strings as the query parameter
    should not retain query options set on a query for subsequent queries, but should retain it in the result
    should allow changing query options for subsequent queries
    should return results as a hash by default
    should be able to return results as an array
    should be able to return results with symbolized keys
    should require an open connection
    should detect closed connection on query read error (FAILED - 2)
    should not allow another query to be sent without fetching a result first
    should describe the thread holding the active query
    should timeout if we wait longer than :read_timeout
    should run signal handlers while waiting for a response
    #socket should return a Fixnum (file descriptor from C)
    #socket should require an open connection
    should be impervious to connection-corrupting timeouts in #execute
    threaded queries should be supported
    evented async queries should be supported
    when a non-standard exception class is raised
      should close the connection when an exception is raised
~~~

I have tried the rebuild with mariadb-connector-c-3.3.10-1.fc41 and it works just fine (and the package also builds fine in F41).

Reproducible: Always

Actual Results:  
rubygem-mysql2 build gets stuck in test suite

Expected Results:  
rubygem-mysql2 build gets passes

This is the test case in question:

https://github.com/brianmario/mysql2/blob/f6a9b68b42a51d1a370403f11eb88527dcb42dc6/spec/mysql2/client_spec.rb#L711-L720

Comment 1 Vít Ondruch 2024-11-01 13:20:39 UTC
BTW could you please integrate mass-prebuild [1] into your workflow? That would help to catch issues like this earlier.


[1]: https://gitlab.com/fedora/packager-tools/mass-prebuild

Comment 2 Michal Schorm 2024-11-15 14:27:17 UTC
I investigated the issue.

I created a what I believe is a reproducer with purely mariadb-connector-c.
The reproducer is pretty ugly, but I'm working with my QA on making it a solid test.

I wasn't able to reproduce the issue with the mariadb-connector-c alone however.
That means that I either haven't actually tested the correct functionality or the problem is in rubygem-mysql2.

--

In the meanwhile I've re-based the mariadb-connector-c in Rawhide, to see if it would e solved by upstream.
It is not, unfortunately. So Once I have a presentable test, I'll get back to it.

--

Side note:
The rubygem-mysql2 test-suite seems to have a significant space for improvement, if it can't handle infinite hangs gracefully.
Could you take a look at that in the meanwhile, so we can assess, how many tests in total actually fails with mariadb-connector-c 3.4 ?

Comment 3 Vít Ondruch 2024-11-26 09:43:32 UTC
Just FTR, there are actually two test cases getting stuck:

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

What is interesting about those is that they are ignored on MaxOS X for ages:

https://github.com/brianmario/mysql2/pull/634/commits/a98b7bbfa594730e1c53c0a0591b0fada494fafa

BTW disabling these two issues, there are also other 3 failures:

~~~
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
~~~

Comment 4 Vít Ondruch 2024-11-26 09:50:13 UTC
BTW, given the errors such as "TLS/SSL error: unexpected eof while reading", it reminds me bug 2324182 in rubygem-pg I was facing recently. This was fixed by:

https://github.com/ged/ruby-pg/pull/607

Comment 5 Vít Ondruch 2024-11-26 10:04:51 UTC
(In reply to Vít Ondruch from comment #4)

Nevertheless, that was triggered by some Kernel changes, while rubygem-mysql2 builds just fine on F41, where the kernel is the same on all Fedora buiders.

Comment 6 Vít Ondruch 2024-11-26 10:22:06 UTC
Reported to rubygem-mysql2 upstream.

Comment 7 Vít Ondruch 2024-11-26 15:30:02 UTC
The FTBFS is troublesome for our work on Ruby 3.4, therefore I have disabled the offending test cases for the moment. Please don't be surprised that the package builds.

https://src.fedoraproject.org/rpms/rubygem-mysql2/c/656c3f1845a181246a9af38cc5d29308b129c5cc

Comment 8 Fedora Update System 2024-11-26 15:34:26 UTC
FEDORA-2024-2eb17cf76d (rubygem-mysql2-0.5.5-6.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-2eb17cf76d

Comment 9 Vít Ondruch 2024-11-26 15:38:21 UTC
Hm, I was optimistic to include `Related:` in changelog, thinking it won't be closing the ticket ...

Comment 10 Fedora Update System 2024-11-26 15:38:31 UTC
FEDORA-2024-2eb17cf76d (rubygem-mysql2-0.5.5-6.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Michal Schorm 2025-02-12 15:08:08 UTC
Does it make sense to have this ticket still opened, after I described in:
  https://src.fedoraproject.org/rpms/rubygem-mysql2/pull-request/19#comment-243812
that the status of the issue (and if it even exists) is unknown until new MariaDB LTS is introduced into Fedora ?

I'd vote for closing this ticket and either re-open it or create new one when (if) the time comes.

Comment 12 Vít Ondruch 2025-02-13 16:17:43 UTC
The test cases were re-enabled and works just fine, so the issue is resolved from my POV. Closing with "CURRENTRELEASE" resolution, because not sure what else would be more suitable.


Note You need to log in before you can comment on or make changes to this bug.