Bug 1470804

Summary: Error product references content which does not exist after importing manifest
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: CandlepinAssignee: Chris "Ceiu" Rog <crog>
Status: CLOSED ERRATA QA Contact: Patrik Segedy <psegedy>
Severity: high Docs Contact:
Priority: high    
Version: 6.3.0CC: awood, bbuckingham, crog, ehelms, jcallaha, psegedy
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1471787 (view as bug list) Environment:
Last Closed: 2018-02-21 16:41:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1471787    
Bug Blocks:    

Description Justin Sherrill 2017-07-13 17:35:09 UTC
Description of problem:

When importing a manifest, deleting it, importing a 2nd (possibly older manifest), deleting it, and then attempting to import the 1st manifest again, I get an error:

Error importing manifest. Runtime Error product references content which does not exist: ContentData [id: 4051, name: Red Hat Enterprise Linux 7 for IBM Power LE - Supplementary (Debug RPMs), label: rhel-7-for-power-le-supplementary-debug-rpms] at org.candlepin.controller.ProductManager.applyProductChanges:675


Version-Release number of selected component (if applicable):
candlepin-2.0.25-1.el7.noarch  (noticed upstream)

How reproducible:
always

Steps to Reproduce:
1. Import the manifest "one.zip" 
2. Delete the manifest "one.zip" from the owner/organization
3. Import the manifest "two.zip" to the same owner
4. Delete the manifest "two.zip" from the owner
5. Attempt to import "One.zip" again

Actual results:
Error importing manifest. Runtime Error product references content which does not exist: ContentData [id: 4051, name: Red Hat Enterprise Linux 7 for IBM Power LE - Supplementary (Debug RPMs), label: rhel-7-for-power-le-supplementary-debug-rpms] at org.candlepin.controller.ProductManager.applyProductChanges:675

Expected results:
Should import fine.

Additional info:

I'm not sure of the full implications of this, but it seems to basically break that owner for me.

Comment 3 Justin Sherrill 2017-07-13 17:39:40 UTC
traceback

2017-07-13 13:28:33,337 [thread=http-bio-8443-exec-1] [req=c84f694c-9098-4046-94c8-0f852c236765, org=testorg1] ERROR org.candlepin.common.exceptions.mappe
rs.CandlepinExceptionMapper - Runtime Error product references content which does not exist: ContentData [id: 4051, name: Red Hat Enterprise Linux 7 for I
BM Power LE - Supplementary (Debug RPMs), label: rhel-7-for-power-le-supplementary-debug-rpms] at org.candlepin.controller.ProductManager.applyProductChan
ges:675
java.lang.IllegalStateException: product references content which does not exist: ContentData [id: 4051, name: Red Hat Enterprise Linux 7 for IBM Power LE
 - Supplementary (Debug RPMs), label: rhel-7-for-power-le-supplementary-debug-rpms]
        at org.candlepin.controller.ProductManager.applyProductChanges(ProductManager.java:675) ~[ProductManager.class:na]
        at org.candlepin.controller.ProductManager.importProducts(ProductManager.java:311) ~[ProductManager.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0.jar:na]
        at org.candlepin.controller.ContentManager.importContent(ContentManager.java:493) ~[ContentManager.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0.jar:na]
        at org.candlepin.controller.CandlepinPoolManager.refreshPoolsWithRegeneration(CandlepinPoolManager.java:309) ~[CandlepinPoolManager.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:58) ~[guice-persist-3.0.jar:na]
        at org.candlepin.controller.Refresher.run(Refresher.java:155) ~[Refresher.class:na]
        at org.candlepin.sync.Importer.importObjects(Importer.java:578) ~[Importer.class:na]
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66) ~[guice-persist-3.0.jar:na]
        at org.candlepin.sync.Importer.doExport(Importer.java:415) ~[Importer.class:na]
        at org.candlepin.sync.Importer.loadExport(Importer.java:174) ~[Importer.class:na]
        at org.candlepin.controller.ManifestManager.importManifest(ManifestManager.java:172) ~[ManifestManager.class:na]
        at org.candlepin.resource.OwnerResource.importManifest(OwnerResource.java:1275) ~[OwnerResource.class:na]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
        at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137) ~[resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296) ~[resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250) ~[resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237) ~[resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.10.Final.
jar:na]
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.10.Final.jar:na]
        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.10.Final.jar:na]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) [tomcat-servlet-3.0-api.jar:na]
        at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263) [guice-servlet-3.0.jar:na]

Comment 4 Alex Wood 2017-07-14 19:35:24 UTC
This is actually a regression.  With git-bisect I tracked this issue down to commit 190bd341c6c76f518f07429ec3e7f2879a49e354

Comment 5 Chris "Ceiu" Rog 2017-07-17 17:57:14 UTC
This bug appears to have been addressed in 2.0.26+ and 2.1+. If the problem persists in these versions, please reopen this BZ.


commit ef6db0ac239a40ed8436a04ff3065e4faa40bf3a
Author: Chris Rog <crog>
Date:   Tue Feb 14 15:32:00 2017 -0500

    Fixed an issue with ContentCurator.getContentByProducts not fetching data
    
    - Worked around an issue in ContentCurator where the getContentByProducts
      method would always return an empty collection

Comment 7 Patrik Segedy 2017-09-29 15:57:02 UTC
Verified on Sat 6.3 snap with candlepin-2.0.40-1.el7.noarch using reproducer from comment 0 using attached manifests.

Steps:
1. hammer --username admin --password pass subscription upload --organization-label Default_Organization --file one.zip
2. hammer --username admin --password pass subscription delete-manifest --organization-label Default_Organization
3. hammer --username admin --password pass subscription upload --organization-label Default_Organization --file two.zip
4. hammer --username admin --password pass subscription delete-manifest --organization-label Default_Organization
5. Upload first manifest again: 
hammer --username admin --password pass subscription upload --organization-label Default_Organization --file one.zip
6. Manifest was imported with no traceback

VERIFIED

Comment 8 Bryan Kearney 2018-02-21 16:39:44 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

Comment 9 Bryan Kearney 2018-02-21 16:41:45 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