Bug 1420406 - [candlepin-2.0] import manifest after delete gives: Runtime Error Index: 0, Size: 0 at java.util.ArrayList.rangeCheck:653
Summary: [candlepin-2.0] import manifest after delete gives: Runtime Error Index: 0, S...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Candlepin
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: Unspecified
Assignee: Michael Stead
QA Contact: Chris Roberts
URL:
Whiteboard:
Depends On: 1420455
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-08 15:05 UTC by Tom McKay
Modified: 2019-04-01 20:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:51:07 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 18424 0 Urgent Rejected [candlepin-2.0] import manifest after delete gives: Runtime Error Index: 0, Size: 0 at java.util.ArrayList.rangeCheck:65... 2021-02-20 01:29:40 UTC

Description Tom McKay 2017-02-08 15:05:35 UTC
To reproduce:
+ import manifest
+ enable repos (not sure required step for reproducer)
+ delete manifest
+ import same manifest

<pre>
2017-02-08 15:01:01,616 [thread=http-bio-8443-exec-6] [req=91ff7192-38db-4370-9111-1389725c6ed1, org=] INFO  org.candlepin.common.filter.LoggingFilter - Request: verb=GET, uri=/candlepin/owners/examplecorp/uebercert
2017-02-08 15:01:01,655 [thread=http-bio-8443-exec-6] [req=91ff7192-38db-4370-9111-1389725c6ed1, org=examplecorp] ERROR org.candlepin.common.exceptions.mappers.CandlepinExceptionMapper - Runtime Error Index: 0, Size: 0 at java.util.ArrayList.rangeCheck:653
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[na:1.8.0_111]
	at java.util.ArrayList.get(ArrayList.java:429) ~[na:1.8.0_111]
	at org.candlepin.resource.OwnerResource.getUeberCertificate(OwnerResource.java:1422) ~[OwnerResource.class:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_111]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_111]
</pre>

Comment 1 Tom McKay 2017-02-08 15:05:41 UTC
Created from redmine issue http://projects.theforeman.org/issues/18424

Comment 3 Tom McKay 2017-02-08 16:12:27 UTC
Debug notes:

SELECT 
       -- NO SUBS FOR 2.0
       
       -- Certificates
       (SELECT Count(*)
        FROM   cp_ent_certificate ec
               INNER JOIN cp_entitlement e
                       ON e.id = ec.entitlement_id
               INNER JOIN cp_pool p
                       ON e.pool_id = p.id
               INNER JOIN cp2_products prod
                       ON prod.uuid = p.product_uuid
        WHERE  prod.NAME LIKE '%_ueber_product') AS UEBER_ENT_CERTS,
        
        -- Entitlements
       (SELECT Count(*)
        FROM   cp_entitlement e
               INNER JOIN cp_pool p
                       ON e.pool_id = p.id
               INNER JOIN cp2_products prod
                       ON prod.uuid = p.product_uuid
        WHERE  prod.NAME LIKE '%_ueber_product') AS UEBER_ENTS,
        
        -- Pools
       (SELECT Count(*)
        FROM   cp_pool p
               INNER JOIN cp2_products prod
                       ON prod.uuid = p.product_uuid
        WHERE  prod.NAME LIKE '%_ueber_product') AS UEBER_POOLS,
        
        -- Content
        (select count(*) from cp2_content c
               inner join cp2_product_content pc on pc.content_uuid=c.uuid
               inner join cp2_products p on p.uuid=pc.product_uuid
               where p.name LIKE '%ueber_product'
        ) AS CP2_UEBER_CONTENT,

        -- Owner Content
        (select count(*) from cp2_owner_content oc
               inner join cp2_content c on c.uuid=oc.content_uuid
               inner join cp2_product_content pc on pc.content_uuid=c.uuid
               inner join cp2_products p on p.uuid=pc.product_uuid
               where p.name LIKE '%ueber_product'
         ) as CP2_OWNER_CONTENT,

         -- Products
         (select count(*) from cp2_products p where p.name LIKE '%ueber_product') AS CP2_PRODUCTS,

         -- Owner Products
         (select count(*) from cp2_owner_products op
             INNER JOIN cp2_products prod on op.product_uuid = prod.uuid
             WHERE prod.name LIKE '%ueber_product'
         ) AS CP2_OWNER_PRODUCTS,

         -- Consumers
         (SELECT Count(*)
             FROM   cp_consumer
             WHERE  NAME = 'ueber_cert_consumer'
         ) AS UEBER_CONSUMER;


Before manifest delete:
 ueber_ent_certs | ueber_ents | ueber_pools | cp2_ueber_content | cp2_owner_content | cp2_products | cp2_owner_products | ueber_consumer 
-----------------+------------+-------------+-------------------+-------------------+--------------+--------------------+----------------
               1 |          1 |           1 |                 1 |                 1 |            1 |                  1 |              1

After manifest delete:
 ueber_ent_certs | ueber_ents | ueber_pools | cp2_ueber_content | cp2_owner_content | cp2_products | cp2_owner_products | ueber_consumer 
-----------------+------------+-------------+-------------------+-------------------+--------------+--------------------+----------------
               0 |          0 |           0 |                 1 |                 1 |            1 |                  1 |              1

Comment 4 Michael Stead 2017-02-09 11:51:33 UTC
Fix is available in candlepin-2.0.25-1

Comment 5 pm-sat@redhat.com 2018-02-21 16:51:07 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-2018:0336


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