flexera-public / right_aws

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

RightAws::AwsError (Permanent EOF is being received from s3.amazonaws.com.) #189

Open hgsongra opened 8 years ago

hgsongra commented 8 years ago

New RightAws::S3Interface using shared connections mode Opening new HTTP connection to s3.amazonaws.com:80 Closing HTTP connection to s3.amazonaws.com:80, reason: 'end of file reached' Rightscale::HttpConnection : server s3.amazonaws.com closed connection Opening new HTTP connection to s3.amazonaws.com:80 Closing HTTP connection to s3.amazonaws.com:80, reason: 'execution expired' Rightscale::HttpConnection : request failure count: 1, exception: # Opening new HTTP connection to s3.amazonaws.com:80 Closing HTTP connection to s3.amazonaws.com:80, reason: 'end of file reached' Rightscale::HttpConnection : server s3.amazonaws.com closed connection Rightscale::HttpConnection : raising RightAws::AwsError due to permanent EOF being received from s3.amazonaws.com, error age: 144 Completed 500 Internal Server Error in 170750.2ms

RightAws::AwsError (Permanent EOF is being received from s3.amazonaws.com.): config/initializers/S3sempleModule.rb:55:in `tmp_key_exsists?'

Here is my code for the module, line 55 is @s3_tmp_bucket.key(key).exists? in tmp_key_exsists? method

right_aws 3.1.0
right_http_connection (1.5.0)
ruby  2.2.2

My module code

`def get_creds
  creds = YAML.load_file("#{::Rails.root.to_s}/config/s3.yml")
  @s3tmpcreds = (creds["temp"] || creds).symbolize_keys
end

def gets3tmp
  @s3tmpcreds ||= get_creds
  @s3tmp ||= RightAws::S3.new(
                @s3tmpcreds[:access_key_id], 
                @s3tmpcreds[:secret_access_key], 
                {:port => 80, :protocol => 'http'}
              )
end

def s3_tmp_bucket_name
  @s3tmpcreds[:bucket]
end

def get_s3_tmp_bucket
  @s3tmp = gets3tmp
  @s3_tmp_bucket ||= @s3tmp.bucket(s3_tmp_bucket_name, true, 'public-read')
end

def tmp_key_exsists?(key)
  @s3_tmp_bucket = get_s3_tmp_bucket
  return false if (key.nil?||key.blank?)
  @s3_tmp_bucket.key(key).exists?
end`

any one have any suggestion or solution?