Response code 503 is returned instead of 404 requesting inexistent queue

Bug #1477122 reported by Valeriy Ponomaryov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Incomplete
Undecided
Unassigned

Bug Description

When we request not existing queue we get following error:

2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages Traceback (most recent call last):
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/transport/wsgi/v1_1/messages.py", line 282, in _pop_messages
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages limit=pop_limit)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/common/pipeline.py", line 97, in consumer
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages tmp = target(*args, **kwargs)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/pooling.py", line 278, in pop
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages return control.pop(queue, project=project, limit=limit)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/common/pipeline.py", line 97, in consumer
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages tmp = target(*args, **kwargs)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/redis/utils.py", line 153, in wrapper
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages return func(*args, **kwargs)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/redis/utils.py", line 186, in wrapper
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages return func(self, *args, **kwargs)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/redis/messages.py", line 528, in pop
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages self.bulk_delete(queue, message_ids, project)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/redis/utils.py", line 153, in wrapper
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages return func(*args, **kwargs)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/redis/utils.py", line 186, in wrapper
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages return func(self, *args, **kwargs)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages File "/opt/stack/zaqar/zaqar/storage/redis/messages.py", line 497, in bulk_delete
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages project)
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages QueueDoesNotExist: Queue private_queue_for_admin_admin does not exist for project da8b6d069b124921b3df5c9854556cb7
2015-07-22 15:31:32.620 30245 ERROR zaqar.transport.wsgi.v1_1.messages
172.18.198.52 - - [22/Jul/2015 15:31:32] "DELETE /v1.1/queues/private_queue_for_admin_admin/messages?pop=1 HTTP/1.1" 503 137

So, we see that internally it knows the reason - "NotFound" but returns improper code. In that case we expect code 404, not 503.

summary: - Response code 503 is returned instead of 404
+ Response code 503 is returned instead of 404 requesting inexistent queue
Revision history for this message
Feilong Wang (flwang) wrote :

Hi Valeriy, can you please provide more info? Like what's the API request you're using? What's the API version? And why do you think it should return 404? Now, if there is no message to pop, [] will be returned. Thanks.

Changed in zaqar:
status: New → Incomplete
Revision history for this message
Valeriy Ponomaryov (vponomaryov) wrote :

Hello Fei Long,

1) "Like what's the API request you're using? What's the API version?" -

I used python client v1.1, which is the same class as for v1 [1].

Initialized it like following:

queue = client.queue(queue_name)

and tried to get message using "pop" method

[1] https://github.com/openstack/python-zaqarclient/blob/master/zaqarclient/queues/client.py

2) "And why do you think it should return 404?" - Because queue is absent and exception "QueueDoesNotExis" is raised. And server error codes should not be returned at all. All exceptions should be handled.

3) "Now, if there is no message to pop, [] will be returned." -

There is no queue, not messages for some queue. I expect 404 for queue request and get 503, that is not expected in any case. Server errors should not be expected at all.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.