Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1356916

Summary: Creating repositories simultanously results in null pointer exception in org.candlepin.model.AbstractHibernateCurator.delete
Product: Red Hat Satellite Reporter: Roman Plevka <rplevka>
Component: CandlepinAssignee: Justin Sherrill <jsherril>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: high Docs Contact:
Priority: medium    
Version: 6.2.0CC: bbuckingham, bcourt, bkearney, hajek, jsherril, rplevka
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:
: 1357118 (view as bug list) Environment:
Last Closed: 2018-02-21 16:54:17 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: 1357118    
Bug Blocks:    
Attachments:
Description Flags
candlepin.log
none
production.log none

Description Roman Plevka 2016-07-15 09:22:41 UTC
Description of problem:
Triggering multiple `repository create` requests asynchronously leads to 

Katello::Errors::CandlepinError: Runtime Error null at org.candlepin.model.AbstractHibernateCurator.delete:326

Task stays in PAUSED:ERROR state and is able to be resumed (and eventually finishes successfully)

Version-Release number of selected component (if applicable):
6.2.0 snap20.1

How reproducible:
often even with 3 simultaneous requests

Steps to Reproduce:
1. create a product
2.
# note teh ampersand at the end of the command - this ensures asynchronous execution of the command throughout the loop
for i in {1..10}; do echo $i; bash -c "hammer --csv -u admin -p changeme repository create --organization-id 1 --product-id ${PROD_ID} --name foo-repo-${i} --content-type yum &"; done


Actual results:
# Message,Id,Name
Repository created,1,foo-repo-1
Could not create the repository:
  Task 54f2d332-889e-46de-bab5-9001b212eb99: Katello::Errors::CandlepinError: Runtime Error null at org.candlepin.model.AbstractHibernateCurator.delete:326
Message,Id,Name
Repository created,4,foo-repo-4
...



Expected results:
all repos create successfully, the tasks don't conflict

Additional info:

The null pointer exception in Candlepin has been already addressed in https://bugzilla.redhat.com/show_bug.cgi?id=1345765 (they won't backport the fix).
However the issue is in katello sending invalid requests to CP

Comment 1 Roman Plevka 2016-07-15 09:32:13 UTC
Created attachment 1180081 [details]
candlepin.log

candlepin.log during the asynchronous repo create requests

Comment 2 Roman Plevka 2016-07-15 09:33:08 UTC
Created attachment 1180082 [details]
production.log

foreman/production.log around the asynchronous repo create requests.

Comment 10 Bryan Kearney 2016-07-22 18:16:19 UTC
Upstream bug component is Candlepin

Comment 11 Bryan Kearney 2016-08-17 14:16:53 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/15482 has been closed

Comment 12 David Ĺ arman 2016-09-05 16:31:30 UTC
The fix in Candlepin will make sure no Nullpointer exceptions will be returned, instead Candlepin will return 400 http code, which is the proper behavior from Candlepins side.
Justin, do you think Kattello can be fixed to handle 400 in case of duplicitous demotions?

Comment 14 Roman Plevka 2016-10-14 11:36:50 UTC
VERIFIED
on sat6.3 snap3
candlepin-0.9.54.10-1.el7.noarch
katello-3.2.0-2.rc1.el7.noarch

no longer reproducible:

<pre>
# for i in {11..30}; do echo $i; bash -c "hammer --csv -u admin -p changeme repository create --organization-id 1 --product-id 1 --name foo-repo-${i} --content-type yum &"; done
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Message,Id,Name
Repository created,11,foo-repo-11
Message,Id,Name
Repository created,12,foo-repo-21
Message,Id,Name
Repository created,13,foo-repo-17
Message,Id,Name
Repository created,14,foo-repo-18
Message,Id,Name
Repository created,15,foo-repo-15
Message,Id,Name
Repository created,16,foo-repo-25
Message,Id,Name
Repository created,17,foo-repo-12
Message,Id,Name
Repository created,18,foo-repo-16
Message,Id,Name
Repository created,19,foo-repo-20
Message,Id,Name
Repository created,20,foo-repo-24
Message,Id,Name
Repository created,21,foo-repo-19
Message,Id,Name
Repository created,22,foo-repo-14
Message,Id,Name
Repository created,23,foo-repo-13
Message,Id,Name
Repository created,24,foo-repo-23
Message,Id,Name
Repository created,25,foo-repo-27
Message,Id,Name
Repository created,26,foo-repo-26
Message,Id,Name
Repository created,27,foo-repo-22
Message,Id,Name
Repository created,28,foo-repo-30
Message,Id,Name
Repository created,29,foo-repo-29
Message,Id,Name
Repository created,30,foo-repo-28
</pre>

Comment 15 Satellite Program 2018-02-21 16:54:17 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