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

NameError: uninitialized constant Aws::Client::Errors #1298

Closed
pmorton opened this Issue Sep 20, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@pmorton

pmorton commented Sep 20, 2016

Hi All - I am trying to diagnse what seems to be a very hairy error. At verying intervals, our application will trap an exception to our error service. The exception is NameError: uninitialized constant Aws::Client::Errors. The partial stack trace can be found here https://gist.github.com/pmorton/c229ef2506d7328efacd0ca0750f702b.

kinesis_base.rb:49 calls client.put_record with the required arguments to put a record to kinesis. Note that this call is run on a different thread than the main application logic. The vast majority of the calls succeed, but at intermittent intervals we received these exceptions.

This happens on our app the runs jruby-1.7.19, however other applications that run MRI doe not seem to exhibit this same behavior.


What I know so far:

  1. Aws::Client::Errors is not defined anywhere in the gem (dynamically or otherwise).
  2. The error handling logic parses the class name of the client to determine where the error should be rooted. https://github.com/aws/aws-sdk-ruby/blob/master/aws-sdk-core/lib/aws-sdk-core/xml/error_handler.rb#L25 . This allows common HTTP errors to be call specific. E.g errors that are raised from Aws::Kinesis::Client will use Aws::Kinesis::Errors:: to raise the proper exception for that service.

My theory, which I cannot seem to easily prove, is that when https://github.com/aws/aws-sdk-ruby/blob/master/aws-sdk-core/lib/aws-sdk-core/xml/error_handler.rb#L24 is executed the client class name is actually being reported as 'Seahorse::Client' which would explain when the error handler is trying root the errors in Client.

Some random thoughts about where the problem might be:

  1. Thread Safety - Since we only see this in JRuby, it is possible that there is code that is not thread safe. Such corruption could lead to partially loaded or defined classes:

@awood45 awood45 added the Version 2 label Sep 20, 2016

@awood45

This comment has been minimized.

Show comment
Hide comment
@awood45

awood45 Sep 20, 2016

Member

Thanks for the investigation here - will dive in to this.

I suspect that your guess around thread safety is the right one. In which case, calling Aws.eager_autoload! (which accepts individual services as parameters if you do not want to autoload the entire SDK) should fix the symptoms.

If you try this workaround and continue to see this error, please do let me know.

Member

awood45 commented Sep 20, 2016

Thanks for the investigation here - will dive in to this.

I suspect that your guess around thread safety is the right one. In which case, calling Aws.eager_autoload! (which accepts individual services as parameters if you do not want to autoload the entire SDK) should fix the symptoms.

If you try this workaround and continue to see this error, please do let me know.

@pmorton

This comment has been minimized.

Show comment
Hide comment
@pmorton

pmorton Sep 20, 2016

Hey - We did the work around many months ago by adding Aws.eager_autoload! as a rails initializer. Unfortunately the issue persists.

pmorton commented Sep 20, 2016

Hey - We did the work around many months ago by adding Aws.eager_autoload! as a rails initializer. Unfortunately the issue persists.

@pmorton

This comment has been minimized.

Show comment
Hide comment
@pmorton

pmorton Sep 21, 2016

@awood45 look like this is a Jruby bug. :( jruby/jruby#3920

pmorton commented Sep 21, 2016

@awood45 look like this is a Jruby bug. :( jruby/jruby#3920

@awood45 awood45 added the third-party label Sep 21, 2016

@awood45

This comment has been minimized.

Show comment
Hide comment
@awood45

awood45 Sep 21, 2016

Member

Interesting - thanks for spotting that!

Member

awood45 commented Sep 21, 2016

Interesting - thanks for spotting that!

@trevorrowe

This comment has been minimized.

Show comment
Hide comment
@trevorrowe

trevorrowe Nov 17, 2016

Member

I'm going to close this issue, as it is currently non-actionable by the SDK. That said, we will be pushing out a preview release shortly of the SDK where the services are modularized into individual gems. With this refactor, we have removed the use of Ruby's autoload which should also side-step this issue entirely.

Member

trevorrowe commented Nov 17, 2016

I'm going to close this issue, as it is currently non-actionable by the SDK. That said, we will be pushing out a preview release shortly of the SDK where the services are modularized into individual gems. With this refactor, we have removed the use of Ruby's autoload which should also side-step this issue entirely.

@trevorrowe trevorrowe closed this Nov 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment