Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php headObject Method is not working. #171

Closed
rr-paras-patel opened this issue Apr 14, 2014 · 15 comments
Closed

php headObject Method is not working. #171

rr-paras-patel opened this issue Apr 14, 2014 · 15 comments

Comments

@rr-paras-patel
Copy link

I want to use following Method via PHP client :

  1. headBucket
  2. doesObjectExist
  3. waitUntilBucketExists
  4. waitUntilBucketNotExists
    Via following Documentation (http://docs.aws.amazon.com/aws-sdk-php/latest/class-Aws.S3.S3Client.html#_doesBucketExist) and all this method using headBucket operation. which is not responding properly.

System Environment:

 php -v
PHP 5.3.3 (cli) (built: Dec 11 2013 03:29:57) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

[System config]
                System version : 1.0.0
                    Cluster Id : leofs_1
                         DC Id : dc_1
                Total replicas : 2
           # of successes of R : 1
           # of successes of W : 1
           # of successes of D : 1
 # of DC-awareness replicas    : 0
                     ring size : 2^128
             Current ring hash : f804bbef
                Prev ring hash : f804bbef
[Multi DC replication settings]
         max # of joinable DCs : 2
            # of replicas a DC : 0

[Node(s) state]
-------+--------------------------+--------------+----------------+----------------+----------------------------
 type  |           node           |    state     |  current ring  |   prev ring    |          updated at         
-------+--------------------------+--------------+----------------+----------------+----------------------------
  S    | storage_0@127.0.0.1      | running      | f804bbef       | f804bbef       | 2014-04-14 01:09:05 +0900
  S    | storage_1@127.0.0.1      | running      | f804bbef       | f804bbef       | 2014-04-14 01:09:05 +0900
  S    | storage_2@127.0.0.1      | running      | f804bbef       | f804bbef       | 2014-04-14 01:09:05 +0900
  S    | storage_3@127.0.0.1      | running      | f804bbef       | f804bbef       | 2014-04-14 01:09:05 +0900

Idle It should be return Request Response like this e.g. :

Sample Request

This requests returns the objects in BucketName.

HEAD / HTTP/1.1
Date: Fri, 10 Feb 2012 21:34:55 GMT
Authorization: authorization string
Host: myawsbucket.s3.amazonaws.com
Connection: Keep-Alive
Sample Response

HTTP/1.1 200 OK
x-amz-id-2: JuKZqmXuiwFeDQxhD7M8KtsKobSzWA1QEjLbTMTagkKdBX2z7Il/jGhDeJ3j6s80
x-amz-request-id: 32FE2CEB32F5EE25
Date: Fri, 10 2012 21:34:56 GMT
Server: AmazonS3

But here for LeoFS Response header doen't return object name or 200 OK.
it gives headers like this(404 Not Found) :

HEAD / HTTP/1.1
Host: test.localhost:8080
User-Agent: aws-sdk-php2/2.6.0 Guzzle/3.8.1 curl/7.19.7 PHP/5.3.3
Date: Mon, 14 Apr 2014 07:22:34 +0000
Authorization: AWS 05236:mEfYFW7i3tudc0yhuyYMTC2Q16s=

HTTP/1.1 404 Not Found
connection: keep-alive
date: Mon, 14 Apr 2014 07:22:34 GMT
content-length: 0
server: LeoFS

Due to this response above all methods are not working.

@yosukehara yosukehara added this to the 1.0.1 milestone Apr 15, 2014
@yosukehara
Copy link
Member

Thank you for your report. We'll check this issue.

@mocchira
Copy link
Member

Hi @Paras2009.
I've fixed this issue just now with this commit(leo-project/leo_gateway@88a28d5).
Please confirm with the latest develop branches?

@rr-paras-patel
Copy link
Author

Hi i have confirmed this updated. It is working fine.

@yosukehara
Copy link
Member

Thank you so much 👍

@rr-paras-patel
Copy link
Author

I want to reopen this issue.

@yosukehara
Copy link
Member

@patelparas What's happen in your environment. Let me know the detail.

@rr-paras-patel
Copy link
Author

doesBucketExist() method always return 'true'.
Whether bucket exist or don't exist.

@mocchira
Copy link
Member

@patelparas please tell me which version of aws-sdk-php you are using?

@rr-paras-patel
Copy link
Author

my aws-sdk-php version is 2.7.5.
Source : https://github.com/owncloud/core/tree/master/apps/files_external/3rdparty/aws-sdk-php

@mocchira
Copy link
Member

@patelparas Thanks.
I could reproduce your issue and almost found out why this happen.
please wait for a while.

@mocchira
Copy link
Member

LeoFS have responded 403 status when the requested bucket doesn't exist,
but sdk expect 404.

We need to respond as below.

ErrorCode: NoSuchBucket
Description: The specified bucket does not exist
HTTP Status: 404

@mocchira
Copy link
Member

@patelparas I found that
http://docs.aws.amazon.com/aws-sdk-php/v2/api/class-Aws.S3.S3Client.html#_doesBucketExist
this method can handle 403 as a NOT FOUND by setting the second argument to false.
So the below test code have passed.

leo-project/leofs_client_tests@61add23

If this works for you, we will close this issue.

@rr-paras-patel
Copy link
Author

ok i will check it. Thank you

@mocchira
Copy link
Member

I found that head_bucket occasionally fails after creating bucket successfully.
So I gonna look into this issue again.

@mocchira
Copy link
Member

found out why.

leo_gateway --- (put_bucket) ---> leo_manager --- (add_bucket) ---> leo_gateway
                                                  ^^^^^^^^^^^ failed due to call wrong function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants