-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
AWS SDK Uninitialized Constant Error #3645
Comments
@smythey21 I see the aws-sdk README notes that this is a common error when unintentionally upgrading from v1.x to v2.x of their API. Is it possible you're impacted by that? Edit Seems that that's the opposite error message from what is presented here (v1 used |
@torrancew we are using aws-sdk 2.2.13 and jruby 9.0.4.0 in production with no issues, but thanks for pointing that out :) |
@smythey21 I'm getting the same thing trying to use S3. It seems that the call to So, there are two bugs: first: jruby's const_set is acting odd in this case and second: the aws gem is playing fast and loose with names. The simple repro for this is:
The return should be The good news is that a second call to
Unfortunately, I can't seem to repro this without using the |
Wow, this is really weird. It works fine in a simple script:
But I can confirm the This is likely related to another bug report that I can't find right now. After some investigation, it appears that 02efc4d by @kares broke this. Many paths now cause constants to be defined as "hidden", which skips setting their names. @kares Can you look into this and repair your patch? |
I'm rather surprised this didn't regress any tests. We need to add some ruby specs for this. |
yy, can look into this next week (unless its fixed by than). thanks. |
@kares I may have a look at it during my flights home today. Can you point me toward any tests you used to verify your fixes, so I don't regress anything? |
did it around constant "hiding" in Java int (e.g. private inner classes) thus |
@kares Ok. |
the issue relates to autoloading ... able to reproduce in a small script. what seems specific here is the auto-loading part doing a callback : module GH3645
class << self
def add_mod(name) # call this from autoloaded script
mod = Module.new { extend GH3645 }
const_set(name, mod)
mod
end
end
autoload :S3, File.expand_path('GH-3645_autoload', File.dirname(__FILE__))
end |
OK, thing I grasp what's going on. the regression is related (and expected) due previous I believe the side effect of the previous logic to set the parent (and name) early on was better than to add it to |
@kares Ok I'll let you take it from here. I did try the patching setConstant to default to non-hidden, which didn't break any JI tests (did you add some for the hidden stuff?)...but it also did not fix the issue. |
... previously this worked as a side effect of fetchConstant "loading" auto-loads but since (b216c5d) `autoload` has been fixed to not initialize prematurely
... this is not crucial but restores the same behavior as in JRuby < 9.0.5.0
@headius yes there's a spec testing hiding non public inner classes as constants now fixed and expected to behave as before. |
@kares Excellent, thank you! |
@jonp solution worked for me. |
Using the latest version of aws-sdk, we started receiving the error
uninitialized constant Aws::Client::Errors
with jruby-9.0.5.0 (though it works fine with 9.0.4.0) when calling.exists?
on an s3 resource. Wondering if anything has changed in 9.0.5.0 that would cause this?The text was updated successfully, but these errors were encountered: