flexera-public / right_aws

RightScale Amazon Web Services Ruby Gems
MIT License
451 stars 175 forks source link

Is S3Interface supposed to be thread-safe? #58

Closed tarcieri closed 13 years ago

tarcieri commented 13 years ago

I've been trying to use what I believe to be the thread safe mode of S3Interface. Earlier RDoc listed this as a :thread_safe => true option to the initializer, but that no longer appears to be supported.

I found the :connections parameter which defaults to :shared and appeared to use thread-specific connection pools, and assumed that meant S3Interface is supposed to be thread-safe.

However, I've been battling a very strange bug on JRuby in Rails thread-safe mode, and it appears to be caused by thread safety problems with S3Interface:

http://jira.codehaus.org/browse/JRUBY-5267

Switching to thread-specific S3Interfaces solved the problem. So first I'm curious if S3Interface is actually intended to be thread safe or not, and if it is, does it require some configuration I'm not doing?

konstantin-dzreev commented 13 years ago

Hi, actually it is not thread-safe but we have that task in our TODOs.

quote: " Right_aws does not support multi-threading (and we don't have that option any more). If you need multiple threads then you must have RightAws::S3 or RightAws::S3Interface instance per thread. Once created the RightAws::S3 instance must be used in the thread if was created. Plz make sure you do this and you do not access one RightAws::S3 instance from different threads"

tarcieri commented 13 years ago

Okay thanks... looks like it's my confusion all along