Bug 1283401 - 500 status (or an empty reply) when getting all consumers
500 status (or an empty reply) when getting all consumers
Status: VERIFIED
Product: Candlepin
Classification: Community
Component: candlepin (Show other bugs)
1.2
All All
high Severity high
: ---
: ---
Assigned To: vritant
Jan Stavel
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-18 16:20 EST by Shayne Riley
Modified: 2016-06-01 11:47 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Shayne Riley 2015-11-18 16:20:03 EST
Description of problem:

Authenticating as an admin, calling GET /consumers with no query parameters returns all consumers in candlepin. However, this can fail if there isn't much memory on the machine and there are a lot of consumers stored in Candlepin.


How reproducible:

Always (provided there isn't much machine memory, and there are many consumers.


Steps to Reproduce:
1. Run a Candlepin instance in a JVM with a heap space of 1GB or less. Ensure there are many consumers (several hundred thousand will work) in Candlepin.
2. Make the following call to the instance: curl -vku $CPADMINUSER:$CPADMINPASS -X GET http://candlepin-host/candlepin/consumers 

Actual results:

One of two outcomes:
1. 500 Internal Server Error, and a stack trace.
2. This curl output:
* Empty reply from server
* Connection #0 to host s02.candlepin.stage.ext.phx2.redhat.com left intact


Expected results:

One of the following:
- a list of all the consumers
- rate-limit the request to prevent this call from happening and allow pagination
Comment 2 Chris Snyder 2015-12-02 14:54:52 EST
Shayne,

What is the reason you are making this curl request? What is the utility? Why do you want to list all consumers?
Comment 3 Shayne Riley 2015-12-02 15:38:27 EST
Chris,

I don't have any legitimate reason for performing this call. This *used* to be called in one of our CP Adapter tests, but it has sense been removed.

The reason this BZ was created was because the API allows for the call to happen, and it seems to only work if there are adequate enough resources to do so. Additionally, http://www.candlepinproject.org/docs/candlepin/api.html#slash-consumers does not mention that the call is deprecated or has special constraints.

Whether the call gets fixed, is deprecated and removed later, or returns a 404 (or some other sensible 400-series status) is fine. I'd just like some closure on this call is all :)
Comment 5 Jan Stavel 2016-06-01 11:47:28 EDT
*** last commit at "git log"

    #+begin_example
    commit b257c6a0523a416bacd3f0698d651db015bea9cb
    Merge: d06634c e4750a5
    Author: Vritant Jain <adarshvritant@gmail.com>
    Date:   Tue May 31 06:52:18 2016 -0400

        Merge pull request #1262 from candlepin/fnguyen/1337906-master

        1337906: Stack derived pool cleanup

    commit d06634ca5d195c74066b994e08883ab9d6b95baf
    #+end_example

*** try to get all customers and see "Must specify at least one search criteria."

    curl -sku admin:admin -X GET https://$candlepin_fqdn:8443/candlepin/consumers  2>&1

    #+RESULTS:
    : {
    :   "displayMessage" : "Must specify at least one search criteria.",
    :   "requestUuid" : "595cc1a1-5430-4fd7-b202-87a409b80f57"
    : }


*** try to get all customers as common user and see "Insufficient permission"

    #+RESULTS:
    : {
    :   "displayMessage" : "Insufficient permissions",
    :   "requestUuid" : "87ed8e23-c99e-49d4-ac6a-d8158841df3c"
    : }

*** try to get all customers as superadmin and see "Must specify at least one search criteria."

    curl -sk -u huey:password -X GET https://$candlepin_fqdn:8443/candlepin/consumers  2>&1

    #+RESULTS:
    : {
    :   "displayMessage" : "Must specify at least one search criteria.",
    :   "requestUuid" : "57dc3bf4-0f0a-472f-a483-0057fe1ccf7b"
    : }

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