Skip to content

Missing respond_to_missing? when delegating to Mysql2::Client #13

@ivoanjo

Description

@ivoanjo

Hey 👋!

I'm Ivo and I work at Datadog on our ddtrace gem.

Recently we ran into a bug with the way mysql2-aurora replaces the Mysql2::Client class. When our gem is starting up, it probes which version of libmysqlclient is in use by the mysql2 gem to decide if it should apply a workaround for a bug in old versions of this library.

It did this by checking the following:

defined?(Mysql2::Client) && Mysql2::Client.respond_to?(:info)

libmysqlclient_version = Gem::Version.new(Mysql2::Client.info[:version])

The extra safety checks need to happen because we don't know if mysql2 is installed or correctly loaded.

These checks failed when mysql2-aurora was loaded because it doesn't implement respond_to_missing? on the class that replaces Mysql2::Client. This broke our check and we needed to add a workaround for it (DataDog/dd-trace-rb#2956) as we were getting this output:

irb(main):002:0> Mysql2::Client.respond_to?(:info)
=> false
irb(main):003:0> Mysql2::Client.info[:version]
=> "8.0.33"

In our case, we've added the workaround, but I thought I'd report this issue upstream, so that hopefully this can be fixed and we can in the future remove the workaround :)

Have an awesome week!

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