aws/aws-sdk-ruby

Fix Seahorse::Client::Plugin::PluginOption shape variation warnings

bkuhlmann opened this issue ยท 6 comments

Describe the bug

Hello. ๐Ÿ‘‹ I'm seeing Ruby warnings when installing the aws-sdk-core gem (via the aws-sdk-s3 gem).

Expected Behavior

I'd expect there to be no warnings when installing this gem.

Current Behavior

This is what I see when installing the gem:

/Users/demo/.cache/frum/versions/3.3.0/lib/ruby/gems/3.3.0/gems/aws-sdk-core-3.191.5/lib/seahorse/client/plugin.rb:116: warning: The class Seahorse::Client::Plugin::PluginOption reached 8 shape variations, instance variables accesses will be slower and memory usage increased.
It is recommended to define instance variables in a consistent order, for instance by eagerly defining them all in the #initialize method.

Reproduction Steps

To reproduce, run this Bundler Inline script:

#! /usr/bin/env ruby
# frozen_string_literal: true

# Save as `demo`, then `chmod 755 demo`, and run as `./demo`.

require "bundler/inline"

gemfile true do
  source "https://rubygems.org"

  gem "debug"
  gem "aws-sdk-s3"
  gem "nokogiri", "~> 1.13"
end

Possible Solution

The problem is that Seahorse::Client::Plugin::PluginOption is defining instance variables in the the wrong order (or they are being initialized in random order).

Additional Information/Context

No response

Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

aws-sdk-core

Environment details (Version of Ruby, OS environment)

ruby 3.3.0 (2023-12-25 revision 5124f9ac75) +YJIT [arm64-darwin23.4.0], macOS 14.4.1

Thank you for the ticket! We will be taking a look.

We were not able to reproduce the bug on our end. Is there any other flags or settings that you were using?

Disregard. We were able to reproduce the error with the -W:performance flag enabled.

We will now investigate a solution

Thanks! Yeah, sorry, I should have mentioned you need that flag enabled. Here's what I always use in my Bash environment if it helps: export RUBYOPT="-W:deprecated -W:performance --yjit". This way I can detect potential production issues early rather than later.

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

This fix will be part of tomorrow's release