Comments (7)
Thank you for reporting this issue. There appears to be a thread-safety issue with how the service interfaces (e.g. AWS::SimpleEmailService
) construct their client. I will try to resolve this issue soon, but you should be able to work around this by constructing the ses interface outside the loop:
require 'aws-sdk'
ses = AWS::SimpleEmailService.new(...)
pool = Array.new(10) do |i|
Thread.new do
ses.send_email(
:subject => 'subject',
:body_html => 'body_html',
:body_text => 'body_text',
:to => '[email protected]',
:from => '[email protected]',
)
end
end
pool.each(&:join)
Please watch this issue for updates.
from aws-sdk-ruby.
@trevorrowe, thanks for the response, but please note that keeping the initialization out of the loop will still have the same issue.
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/aws-sdk-1.7.1/lib/aws/core/signature/version_4.rb:87:in `service': NotImplementedError (NotImplementedError)
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/aws-sdk-1.7.1/lib/aws/core/client.rb:499:in build_request': undefined method
add_authorization!' for #AWS::SimpleEmailService::Request:0x007fdff13558d0 (NoMethodError)
from aws-sdk-ruby.
Given the following example
require 'aws-sdk'
ses = AWS::SimpleEmailService.new # loading credentials from environment
pool = Array.new(10) do |i|
Thread.new do
ses.send_email(
:subject => 'subject',
:body_html => 'body_html',
:body_text => 'body_text',
:to => '[email protected]',
:from => '[email protected]', # replace this with a verified email address
)
end
end
pool.each(&:join)
I was able to execute this many times without issue. If I moved the ses assignment inside the Thread.new block, then it would fail every time due to thread safety issues. Is this what your test example looks like?
from aws-sdk-ruby.
@trevorrowe, I've been able to execute it multiple times without issue as well, but If I keep at it I do get the occasional add_authorization error. Havn't been able to reproduce the error at "version_4.rb:87" again though.
My test file is exactly the same except for the array size which I've set to 90 and of course the from email.
from aws-sdk-ruby.
@desheikh I just pushed a commit that resolves an issue with AWS::Core::Configuration. I then took your original example and added one line. Between the two, this resolved the issue for me.
AWS.eager_autoload!
I realize this is not an ideal fix. It forcibly loads all AWS classes up-front, which can be slow, but it is a one-time cost. That said, this is not an issue in Ruby 2.0 and you can drop the call to eager_autoload! if you are able to upgrade.
from aws-sdk-ruby.
Closing this issue as it should work properly if all classes have been eagerly auto-loaded. Please re-open if you still run into issues.
from aws-sdk-ruby.
Hi,
Thanks, I just tested out sending mails out with the latest version of the sdk and so far have not experienced any issues yet even without the eager_autoload.
AWS.eager_autoload! raises an exception though, created a separate issue for it.
from aws-sdk-ruby.
Related Issues (20)
- gem install aws-sdk 3.1.0 / aws-sdk-applicationdiscoveryservice-1.49.0 missing ri file HOT 10
- Include specs in published gems HOT 4
- SESV2 ListContacts breaks with "Content-Length not given and Transfer-Encoding is not `chunked'" HOT 8
- Infer AWS HTTP request payload size HOT 6
- Aws::S3::Presigner #presigned_url to allow a custom hostname HOT 4
- Aws::STS::Errors::InvalidClientTokenId HOT 7
- Feature: Allow QueuePoller to be interrupted from another thread HOT 1
- aws-sdk-s3 fails when downloading file of exactly 20971524 bytes from S3 bucket bug HOT 16
- Feature: Support `stub_responses:` kwarg in InstanceProfileCredentials HOT 4
- Need WorkerId in Mturk Event HOT 2
- Can't decrypt noncurrent versions of files using EncryptionV2 with kms(short issue description) HOT 1
- Can't create S3 presigned URLs HOT 9
- Chime: event_ingestion_url will be nil when use_fips_endpoint is true HOT 4
- Aws:STS:Presigner sometimes sets X-Amz-Expires < 900 HOT 17
- `Checksum validation failed` since aws-sdk-s3 1.132.0 HOT 1
- Add a way to disable checksum_mode HOT 1
- SDK fails to use SSO credentials configured via `aws configure sso` HOT 2
- aws-sdk-translate - translate_document returns text in wrong encoding HOT 6
- Stub response_target HOT 7
- Object#download_file Add Progress Callback HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-ruby.