Bug 2167685

Summary: [BUG] Manifest re-import fails with error "Unexpected exception occured while executing transactional block" in Satellite 6.13
Product: Red Hat Satellite Reporter: Sayan Das <saydas>
Component: CandlepinAssignee: Barnaby Court <bcourt>
Status: CLOSED ERRATA QA Contact: Shweta Singh <shwsingh>
Severity: high Docs Contact:
Priority: high    
Version: 6.13.0CC: ahumbe, chrobert, juwatts, nmoumoul, pcreech, shwsingh
Target Milestone: 6.13.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: candlepin-4.2.6-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-03 13:24:54 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:

Description Sayan Das 2023-02-07 09:08:09 UTC
Description of problem:

Based on https://bugzilla.redhat.com/show_bug.cgi?id=2122945, The "Entity version collison" issue was expected to be fixed in Satellite 6.12 and candlepin-4.2.6-1, candlepin-4.1.15-1 

But Satellite 6.13 comes with candlepin-4.2.3-1 and if i delete the exported manifest and reimport a new manifest, The same issue is very easily reproducible. 


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

# rpm -q candlepin satellite
candlepin-4.2.3-1.el8sat.noarch
satellite-6.13.0-4.el8sat.noarch

How reproducible:

Always if followed a specific sequence of actions


Steps to Reproduce:

* Installed Satellite 6.13 ( latest snap )

* Imported a manifest 

* Enabled a few repos ( but none of them needs to be synced )

* Deleted the imported manifest from the satellite UI

* Created a new allocation, exported its zip, and tried to import it back to Satellite.


Actual Results:

Fails with error 

```
Katello::Errors::CandlepinError

org.candlepin.async.JobExecutionException: Unexpected exception occurred while executing transactional block
```

In logs:
```
-8b05-34d3972587de] WARN  org.candlepin.controller.refresher.RefreshWorker - Multiple versions of the same content received during refresh; discarding previous: 4943 => C
ontentDTO [id: 4943, name: dotNET on RHEL (ISOs) for Red Hat Enterprise Linux 7 Server, label: rhel-7-server-dotnet-isos], ContentDTO [id: 4943, name: dotNET on RHEL (ISO
s) for Red Hat Enterprise Linux 7 Server, label: rhel-7-server-dotnet-isos]
2023-02-07 14:15:06,034 [thread=Thread-275 (ActiveMQ-client-global-threads)] [job=8aca436986135c2f01862b0cce236b8d, job_key=ImportJob, org=RedHat, csid=cf8ab0c1-8c0e-4acb
-8b05-34d3972587de] WARN  org.candlepin.util.Transactional - Transactional block executed with a transaction already started
2023-02-07 14:15:06,560 [thread=Thread-275 (ActiveMQ-client-global-threads)] [job=8aca436986135c2f01862b0cce236b8d, job_key=ImportJob, org=RedHat, csid=cf8ab0c1-8c0e-4acb
-8b05-34d3972587de] ERROR org.candlepin.controller.refresher.visitors.ProductNodeVisitor - Entity version collision detected: Product [uuid: null, id: 180, name: Red Hat 
Beta] != Product [uuid: 8aca436986135c2f01861360cafe27fc, id: 180, name: Red Hat Beta]
2023-02-07 14:15:06,583 [thread=Thread-275 (ActiveMQ-client-global-threads)] [job=8aca436986135c2f01862b0cce236b8d, job_key=ImportJob, org=RedHat, csid=cf8ab0c1-8c0e-4acb
-8b05-34d3972587de] ERROR org.candlepin.sync.Importer - Recording import failure
org.candlepin.util.TransactionExecutionException: Unexpected exception occured while executing transactional block
        at org.candlepin.util.Transactional.executeNested(Transactional.java:379)
        at org.candlepin.util.Transactional.execute(Transactional.java:501)
        at org.candlepin.controller.refresher.RefreshWorker.execute(RefreshWorker.java:537)
        at org.candlepin.controller.CandlepinPoolManager.refreshPoolsWithRegeneration(CandlepinPoolManager.java:271)
        at org.candlepin.controller.Refresher.run(Refresher.java:154)
        at org.candlepin.sync.Importer.importObjects(Importer.java:597)
        at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:56)
        at org.candlepin.sync.Importer.doExport(Importer.java:428)
        at org.candlepin.sync.Importer.loadStoredExport(Importer.java:209)

```


Expected Results:

No such errors. 


Additional Info:


Based on https://bugzilla.redhat.com/show_bug.cgi?id=2122945, it should be already fixed in 6.12 and candlepin version candlepin-4.2.6-1, candlepin-4.1.15-1 

Based on https://bugzilla.redhat.com/show_bug.cgi?id=2123384 it's fixed in candlepin-4.2.6-1

So do we need updated candlepin version in Sat 6.13 i.e. candlepin-4.2.6-1 or above ?

Comment 5 Shweta Singh 2023-02-28 11:07:37 UTC
Verified.

Version Tested: Satellite 6.13 Snap 12.0

Verification Steps:
1. Import a manifest on Satellite.
2. Enable fer repositories.
3. Delete the imported manifest.
4. Create new allocation, export it in zip format and upload it back to satellite.

Result:
New manifest gets uploaded without any errors and repositories can be enabled.

Comment 8 errata-xmlrpc 2023-05-03 13:24:54 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 (Important: Satellite 6.13 Release), 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-2023:2097