Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ivoanjo opened this issue Jul 10, 2023 · 0 comments
Open

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

ivoanjo opened this issue Jul 10, 2023 · 0 comments

Comments

@ivoanjo
Copy link

ivoanjo commented Jul 10, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant