Bug 1734550 - GetBucketLocation on non-existing bucket doesn't throw NoSuchBucket and gives 200
Summary: GetBucketLocation on non-existing bucket doesn't throw NoSuchBucket and give...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Ceph Storage
Classification: Red Hat
Component: RGW
Version: 3.2
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: 3.3
Assignee: Matt Benjamin (redhat)
QA Contact: RUDRA PRATAP
URL:
Whiteboard:
Depends On:
Blocks: 1725227
TreeView+ depends on / blocked
 
Reported: 2019-07-30 20:34 UTC by Vikhyat Umrao
Modified: 2019-11-11 09:50 UTC (History)
10 users (show)

Fixed In Version: RHEL: ceph-12.2.12-1.el7cp Ubuntu: ceph_12.2.12-4redhat1xenial
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-21 15:11:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2538 None None None 2019-08-21 15:11:24 UTC

Description Vikhyat Umrao 2019-07-30 20:34:19 UTC
Description of problem:
GetBucketLocation  on non-existing bucket doesn't throw NoSuchBucket and gives 200


Version-Release number of selected component (if applicable):
RHCS 3.2.z2
12.2.8-128.el7cp

How reproducible:
Always

We are able to reproduce.

$ aws s3api get-bucket-location --bucket rht-test --endpoint-url http://10.74.128.31:8081
{
    "LocationConstraint": "cee"
}

^^ works for the existing bucket.

Log line:

2019-07-31 01:50:36.223837 7fcc6e3b0700  1 ====== starting new request req=0x7fcc6e3a9f70 =====
2019-07-31 01:50:36.228009 7fcc6e3b0700  1 ====== req done req=0x7fcc6e3a9f70 op status=0 http_status=200 ======
2019-07-31 01:50:36.228044 7fcc6e3b0700  1 civetweb: 0x5636d70b49d8: 10.3.116.111 - - [31/Jul/2019:01:50:36 +0530] "GET /rht-test?location HTTP/1.1" 200 270 - aws-cli/1.16.111 Python/3.7.4 Linux/5.1.18-300.fc30.x86_64 botocore/1.12.101


$ aws s3api get-bucket-location --bucket rht-tes --endpoint-url http://10.74.128.31:8081 
{
    "LocationConstraint": null
}

No bucket name - rht-tes but give response as NULL but does not say NoSuchBucket.

Logline for the non-existent bucket - rht-tes.

2019-07-31 01:50:58.938044 7fcc6e3b0700  1 ====== starting new request req=0x7fcc6e3a9f70 =====
2019-07-31 01:50:58.939926 7fcc6e3b0700  1 ====== req done req=0x7fcc6e3a9f70 op status=0 http_status=200 ======
2019-07-31 01:50:58.939958 7fcc6e3b0700  1 civetweb: 0x5636d70b49d8: 10.3.116.111 - - [31/Jul/2019:01:50:58 +0530] "GET /rht-tes?location HTTP/1.1" 200 267 - aws-cli/1.16.111 Python/3.7.4 Linux/5.1.18-300.fc30.x86_64 botocore/1.12.101

In both cases, it gives 200.

Comment 3 Vikhyat Umrao 2019-07-30 23:21:48 UTC
Hi Matt,

I was looking into the code which went with this Bug 1705922(https://github.com/ceph/ceph/pull/26569) and built it with a vstart cluster but looks like it was fixed way before this patch as this is still not backported in upstream luminous - https://tracker.ceph.com/issues/39696. Then I tested this with RHCS 3.3 current build - 12.2.12-40.el7cp and it is working fine with RHCS 3.3(12.2.12) rebase. In fact, it is working fine in 12.2.10 upstream so some fix came in between 12.2.8 to 12.2.10.

$ aws s3api get-bucket-location --bucket mybucket1 --endpoint-url http://10.8.129.236:8080
{
    "LocationConstraint": "us"
}

$ aws s3api get-bucket-location --bucket mybuc --endpoint-url http://10.8.129.236:8080 

An error occurred (NoSuchBucket) when calling the GetBucketLocation operation: Unknown

I think we should be able to close this one as RHCS 3.3 CURRENTRELEASE.

Thank you,
Vikhyat

Comment 6 RUDRA PRATAP 2019-08-05 11:59:37 UTC
Hi Matt,

RHCS 3.3 , ceph version - 12.2.12-40.el7cp

I tried this on my setup, on a versioned bucket.
While having a bucket present it shows HTTPStatusCode: 200 , and while changing the bucket name to a no existent bucket , it throws an error with "botocore.errorfactory.NoSuchBucket".
Can check the outputs below that i got.

--------------------------------------------------------------------
---> non-existing bucket 
[root@magna107 ~]# cat 3bg.py 
import boto3
access_key = '12345'
secret_key = '67890'

s3_production = boto3.client('s3', endpoint_url='http://magna107:80', 
                       aws_access_key_id = access_key,
                       aws_secret_access_key = secret_key
)

print(s3_production.get_bucket_location(Bucket='my-bucket'))

------------------------------------------------------------------------
---> output 
[root@magna107 ~]# python2 3bg.py 
Traceback (most recent call last):
  File "3bg.py", line 10, in <module>
    print(s3_production.get_bucket_location(Bucket='my-bucket'))
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.NoSuchBucket: An error occurred (NoSuchBucket) when calling the GetBucketLocation operation: Unknown

-----------------------------------------------------------------------------

---> if the bucket name is changed to an existing bucket..
{'LocationConstraint': None, 'ResponseMetadata': {'HTTPStatusCode': 200, 'RetryAttempts': 0, 'HostId': '', 'RequestId': 'tx00000000000000000002c-005d48188b-a71cf-default', 'HTTPHeaders': {'date': 'Mon, 05 Aug 2019 11:52:43 GMT', 'content-length': '127', 'x-amz-request-id': 'tx00000000000000000002c-005d48188b-a71cf-default'}}}


--------------------------------------------------------------------------------

Let me know if you need some more details.
Rudra

Comment 8 errata-xmlrpc 2019-08-21 15:11:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2538


Note You need to log in before you can comment on or make changes to this bug.