Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Non-threadsafe libraries and EventMachine #3

Closed
JoshuaOSHickman opened this Issue · 7 comments

3 participants

@JoshuaOSHickman

I see you're using the AWS autoloader. I highly recommend you drop in:

AWS.eager_autoload!

As well, as otherwise the AWS library itself isn't threadsafe. Since EventMachine can't/doesn't run in a non-threaded environment (a unicorn deployment, for instance), this problem is basically impossible to avoid, and I had a couple heisenbugs on this one. The line of code doesn't change the functionality of the library in any way, but it's a little obscure and took me a while to find even after I figured out what the problem was.

Since it's something that must be in all the projects that use this library, it might save some people the confusion of the undefined method exceptions deep within the dark depths of Amazon's code. There might be an issue with you calling it too soon if people are using other patches to the aws-sdk, but I haven't seen any troubles.

Thanks for sharing the cool code. This isn't an issue so much as a suggestion (maybe the best solution is me issuing a pull request for a change to the readme?)

@JoshMcKin
Owner

Nice catch. A pull request would be accepted. Hopefully AWS will be updated with a thread safe autoload feature before the current default ruby autoload is depreciated.

Thanks,

@JoshuaOSHickman

I issued a pull request for the change -- if you are worried about those cowboys without Gemfile.locks, I can submit the change to the README.

@JoshMcKin
Owner

released in 0.1.2

@JoshMcKin
Owner

Not too concerned about folks without Gemfile.locks in their deployed applications, at this time. If it becomes an issue we can address it then.

Thanks,

@johnkchow

Ah, so this is why I was seeing those weird NoMethodErrors when I tried using the gem + EM months ago. @JoshMcKin just want to let you know that since the update, I haven't seen the NoMethodError pop up in my apps. Thanks guys.

@JoshuaOSHickman

Yeah, this is a weird one, no doubt. Another thing I noticed is that the SessionSigner is often auto-loaded incorrectly by amazon. I believe the registered autoloads are conflicting depending on the order of loading the libraries -- putting the correct order in the readme/ making this gem more flexible would be nice for people.

Symptom is having NoMethodError on SessionSigner, which has only the method defined here.

@JoshMcKin you seen anything like this?

@JoshMcKin
Owner

Nope. I run async Rails 3.0 and never saw this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.