Bug 960944 - G4S: DELETE on container that does not exist returns 503 instead of 404
Summary: G4S: DELETE on container that does not exist returns 503 instead of 404
Keywords:
Status: VERIFIED
Alias: None
Product: Gluster-Swift
Classification: Community
Component: container-server
Version: 0.1
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Nobody
QA Contact: David J. Mac Donald
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-05-08 10:58 UTC by pushpesh sharma
Modified: 2023-01-31 23:41 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description pushpesh sharma 2013-05-08 10:58:34 UTC
Description of problem:


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
[root@dhcp207-5 swift]# curl -v -X DELETE -H 'X-Auth-Token: AUTH_tk0efc970d210444c09ccfa5209ef0f963' -k https://10.65.207.5:443/v1/AUTH_test2/dir2222
* About to connect() to 10.65.207.5 port 443 (#0)
*   Trying 10.65.207.5...
* connected
* Connected to 10.65.207.5 (10.65.207.5) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
* 	subject: O=Default Company Ltd,L=Default City,C=XX
* 	start date: May 08 15:24:51 2013 GMT
* 	expire date: Jun 07 15:24:51 2013 GMT
* 	common name: (nil)
* 	issuer: O=Default Company Ltd,L=Default City,C=XX
> DELETE /v1/AUTH_test2/dir2222 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 10.65.207.5
> Accept: */*
> X-Auth-Token: AUTH_tk0efc970d210444c09ccfa5209ef0f963
> 
< HTTP/1.1 503 Internal Server Error
< Content-Type: text/html; charset=UTF-8
< Content-Length: 0
< Date: Wed, 08 May 2013 16:24:08 GMT
< 
* Connection #0 to host 10.65.207.5 left intact
* Closing connection #0

2. From swift functional test report 

FAIL: testDeleteOnContainerThatDoesNotExist (test.functional.tests.TestContainer)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/psharma/git/swift/test/functional/tests.py", line 561, in testDeleteOnContainerThatDoesNotExist
    self.assert_status(404)
  File "/home/psharma/git/swift/test/functional/tests.py", line 158, in assert_status
    (self.env.conn.response.status, status_or_statuses))
AssertionError: Status returned: 503 Expected: 404



3.
  
Actual results:


Expected results:


Additional info:

[root@dhcp207-5 swift]# rpm -qa|grep swift
glusterfs-swift-3.3.1-13.fc18.noarch
glusterfs-swift-container-3.3.1-13.fc18.noarch
glusterfs-swift-account-3.3.1-13.fc18.noarch
glusterfs-swift-object-3.3.1-13.fc18.noarch
glusterfs-swift-proxy-3.3.1-13.fc18.noarch
python-swiftclient-1.2.0-3.fc18.noarch

Comment 1 Luis Pabón 2013-06-11 02:40:52 UTC
Reproduced using: 
glusterfs-openstack-swift-1.8.0-27.noarch (Fedora 18)

Commands:
[root@heka-client-10 swift]# curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1...
* connected
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.27.0
> Host: 127.0.0.1:8080
> Accept: */*
> X-Storage-User: test:tester
> X-Storage-Pass: testing
> 
< HTTP/1.1 200 OK
< X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_test
< X-Auth-Token: AUTH_tk37164f9de27641c68c35ff38f3e9b450
< Content-Type: text/html; charset=UTF-8
< X-Storage-Token: AUTH_tk37164f9de27641c68c35ff38f3e9b450
< Content-Length: 0
< Date: Tue, 11 Jun 2013 02:37:01 GMT
< 
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0
[root@heka-client-10 swift]# curl -i -X DELETE -H 'X-Auth-Token: AUTH_tk37164f9de27641c68c35ff38f3e9b450' http://127.0.0.1:8080/v1/AUTH_test/somecontainer
HTTP/1.1 400 Bad Request
Content-Length: 59
Content-Type: text/html; charset=UTF-8
Date: Tue, 11 Jun 2013 02:38:30 GMT

Comment 2 Luis Pabón 2013-06-11 04:06:02 UTC
It seems we raise an error, and it is not being caught.  Here is the traceback for a container that does not exist:
container-server ERROR __call__ error with DELETE /test/0/AUTH_test/somecontainer : 
Traceback (most recent call last):
  File "/root/swift/swift/container/server.py", line 519, in __call__
    res = method(req)
  File "/root/swift/swift/common/utils.py", line 1558, in wrapped
    return func(*a, **kw)
  File "/root/swift/swift/common/utils.py", line 520, in _timing_stats
    resp = func(ctrl, *args, **kwargs)
  File "/root/swift/swift/container/server.py", line 196, in DELETE
    if not broker.empty():
  File "/usr/lib/python2.7/site-packages/gluster/swift/common/DiskDir.py", line 186, in empty
    return dir_empty(self.datadir)
  File "/usr/lib/python2.7/site-packages/gluster/swift/common/fs_utils.py", line 175, in dir_empty
    raise FileOrDirNotFoundError()
FileOrDirNotFoundError (txn: tx3aa45464206a4df59bc1b4e314afbf78)


AFAIK, I think the issue is that DiskDir:186 is supposed to return that it is only empty when there are no containers in the volume.  I think this is shown by the comments on swift/common/db.py.

Comment 3 Luis Pabón 2013-06-11 18:37:53 UTC
Fix has been submitted (new unit test added):
http://review.gluster.org/5201

Verified using functional test:
[root@heka-client-10 swift]# nosetests --exe test/functional/tests.py:TestContainer.testDeleteOnContainerThatDoesNotExist
testDeleteOnContainerThatDoesNotExist (test.functional.tests.TestContainer) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.391s

OK

Comment 4 pushpesh sharma 2013-07-15 08:56:32 UTC
Verified using functional test:-

nosetests --exe ~/gluster-swift/test/functional/tests.py:TestContainer.testDeleteOnContainerThatDoesNotExist
.
----------------------------------------------------------------------
Ran 1 test in 1.312s

OK

Verified using curl :-
# curl -v -X DELETE -H 'X-Auth-Token: AUTH_tk47831d366b06476a876a274b7a13da0b'  http://localhost:8080/v1/AUTH_test/dirDoNotExist
* About to connect() to localhost port 8080 (#0)
*   Trying ::1... Connection refused
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> DELETE /v1/AUTH_test/dirDoNotExist HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: localhost:8080
> Accept: */*
> X-Auth-Token: AUTH_tk47831d366b06476a876a274b7a13da0b
> 
< HTTP/1.1 404 Not Found
< Content-Length: 70
< Content-Type: text/html; charset=UTF-8
< Date: Mon, 15 Jul 2013 08:55:13 GMT
< 
* Connection #0 to host localhost left intact
* Closing connection #0
<html><h1>Not Found</h1><p>The resource could not be found.</p></html>[root@dhcp207-210 ~]# 






Verified on:-

#rpm -qa|grep gluster
gluster-swift-object-1.8.0-6.3.el6rhs.noarch
vdsm-gluster-4.10.2-22.7.el6rhs.noarch
gluster-swift-plugin-1.8.0-2.el6rhs.noarch
glusterfs-geo-replication-3.4.0.12rhs.beta3-1.el6rhs.x86_64
glusterfs-3.4.0.12rhs.beta3-1.el6rhs.x86_64
gluster-swift-1.8.0-6.3.el6rhs.noarch
glusterfs-server-3.4.0.12rhs.beta3-1.el6rhs.x86_64
gluster-swift-proxy-1.8.0-6.3.el6rhs.noarch
gluster-swift-account-1.8.0-6.3.el6rhs.noarch
glusterfs-rdma-3.4.0.12rhs.beta3-1.el6rhs.x86_64
glusterfs-fuse-3.4.0.12rhs.beta3-1.el6rhs.x86_64
gluster-swift-container-1.8.0-6.3.el6rhs.noarch


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