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

No objects after restart of fakes3 #22

Open thekorn opened 11 years ago

thekorn commented 11 years ago

I'm using HEAD of fakes3, and whenever I restart the fakes3 server lookinng up keys is not working anymore, I always get an empty list of objects for each bucket.

robguttman commented 11 years ago

I needed to patch fake-s3 to handle a case that led to same exact behavior:

https://github.com/robguttman/fake-s3/commit/7bfc57ede19466d6b6be489b30557be7d6f610f7

May or may not be your problem though.

On Jan 5, 2013, at 1:25 PM, Markus Korn notifications@github.com wrote:

I'm using HEAD of fakes3, and whenever I restart the fakes3 server lookinng up keys is not working anymore, I always get an empty list of objects for each bucket.

— Reply to this email directly or view it on GitHub.

runemadsen commented 11 years ago

I'm seeing the exact same problem using the AWS-S3 ruby gem. Everything works great, but after server restart I get "AWS::S3::NoSuchKey ". Checking the fakes3 folder, the files are there.

The proposed patch is not working.

Any ideas on what could cause this?

dterhorst-zz commented 10 years ago

I worked around this locally with the following changes in lib/fakes3/file_store.rb:

19c19
<         bucket_obj = Bucket.new(bucket_name,Time.now,[])
---
>         bucket_obj = Bucket.new(bucket_name,Time.now,get_objects(bucket_name, bucket))
199a200,206
> 
>   private
>     def get_objects bucket_name, path
>       Dir[File.join(path, '*')].map do |filepath|
>         get_object(bucket_name, File.basename(filepath), nil)
>       end
>     end
mark2997 commented 10 years ago

I just had the same problem - objects are no longer listed after restarting the server, although I can still GET them. I applied the fix from dterhorst and it worked. This would be a good pull request.

saltzmanjoelh commented 8 years ago

I had to use a combination of fixes here to get it working in my fork:

https://github.com/saltzmanjoelh/fake-s3