jubos / fake-s3

A lightweight server clone of Amazon S3 that simulates most of the commands supported by S3 with minimal dependencies
2.94k stars 355 forks source link

Bucket keys containing a hyphen causes timeouts #91

Open zundra opened 9 years ago

zundra commented 9 years ago
Breaks 100% of the time with a timeout. As long as the bucket name contains a hyphen the request times out

[39] pry(main)> s3 = AWS::S3.new(:access_key_id => Settings.s3.access_key_id, :secret_access_key => Settings.s3.access_key_id, :s3_endpoint => 'localhost',:s3_port => 9444, :use_ssl => false) => AWS::S3 [40] pry(main)> bucket = s3.buckets["foo-bar"] => #AWS::S3::Bucket:foo-bar [41] pry(main)> object = bucket.objects["key1"] => AWS::S3::S3Object:foo-bar/key1 [42] pry(main)> object.write("testtest") [AWS S3 200 62.120395 3 retries] put_object(:bucket_name=>"foo-bar",:content_length=>8,:data=>#StringIO:0x007f96fb8d30d0,:key=>"key1") Net::OpenTimeout execution expired

Net::OpenTimeout: execution expired from /Users/zundradaniel/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/net/http.rb:879:in `initialize' [43] pry(main)>

Same call but underscore instead of a hyphen works

[43] pry(main)> s3 = AWS::S3.new(:access_key_id => Settings.s3.access_key_id, :secret_access_key => Settings.s3.access_key_id, :s3_endpoint => 'localhost',:s3_port => 9444, :use_ssl => false) => AWS::S3 [44] pry(main)> bucket = s3.buckets["foo_bar"] => #AWS::S3::Bucket:foo_bar [45] pry(main)> object = bucket.objects["key1"] => AWS::S3::S3Object:foo_bar/key1 [46] pry(main)> object.write("testtest") [AWS S3 200 6.008638 0 retries] put_object(:bucket_name=>"foo_bar",:content_length=>8,:data=>#StringIO:0x007f96f97a68f8,:key=>"key1")

=> AWS::S3::S3Object:foo_bar/key1 [47] pry(main)>

connorjacobsen commented 9 years ago

I am also getting this bug. Currently on version 0.2.1.

ndench commented 7 years ago

Did this ever get resolved? I seem to getting this bug as well and I'm on version 1.2.0.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions
  If the error persists, please report the
  following lines (removing any private
  info as necessary) to:
   s3tools-bugs@lists.sourceforge.net

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Invoked as: /usr/bin/s3cmd mb s3://dev-bucket
Problem: gaierror: [Errno -2] Name or service not known
S3cmd:   1.6.1
python:   2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609]
environment LANG=en_US.UTF-8

Traceback (most recent call last):
  File "/usr/bin/s3cmd", line 2919, in <module>
    rc = main()
  File "/usr/bin/s3cmd", line 2841, in main
    rc = cmd_func(args)
  File "/usr/bin/s3cmd", line 205, in cmd_bucket_create
    response = s3.bucket_create(uri.bucket(), cfg.bucket_location)
  File "/usr/lib/python2.7/dist-packages/S3/S3.py", line 367, in bucket_create
    response = self.send_request(request)
  File "/usr/lib/python2.7/dist-packages/S3/S3.py", line 1081, in send_request
    conn = ConnMan.get(self.get_hostname(resource['bucket']))
  File "/usr/lib/python2.7/dist-packages/S3/ConnMan.py", line 192, in get
    conn.c.connect()
  File "/usr/lib/python2.7/httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known

But switching to underscores works fine.

ubuntu@ubuntu-xenial:~$ s3cmd mb s3://dev_bucket
Bucket 's3://dev_bucket/' created