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 1344709 - Database deadlock when creating multiple hosts in parallel
Summary: Database deadlock when creating multiple hosts in parallel
Keywords:
Status: CLOSED DUPLICATE of bug 1341338
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: Unspecified
Assignee: Chris Duryee
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-10 12:38 UTC by Lukas Zapletal
Modified: 2016-06-15 17:40 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-06-15 17:40:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lukas Zapletal 2016-06-10 12:38:53 UTC
Reproducer:

Create several processes that create content hosts (hammer host create) in parallel.

2016-06-10 10:58:53 CEST ERROR:  deadlock detected
2016-06-10 10:58:53 CEST DETAIL:  Process 19805 waits for ShareLock on transaction 1661291; blocked  +by process 24817.
        Process 24817 waits for ExclusiveLock on tuple (0,24) of relation 18010 of database 17659;   +blocked by process 19805.
        Process 19805: UPDATE "hostgroups" SET "hosts_count" = COALESCE("hosts_count", 0) + 1 WHERE  +"hostgroups"."id" = 2
        Process 24817: UPDATE "hostgroups" SET "hosts_count" = COALESCE("hosts_count", 0) + 1 WHERE  +"hostgroups"."id" = 2
2016-06-10 10:58:53 CEST HINT:  See server log for query details.
2016-06-10 10:58:53 CEST STATEMENT:  UPDATE "hostgroups" SET "hosts_count" = COALESCE("hosts_count", +0) + 1 WHERE "hostgroups"."id" = 2

2016-06-10 10:58:53 CEST ERROR:  deadlock detected
2016-06-10 10:58:53 CEST DETAIL:  Process 19784 waits for ShareLock on transaction 1661291; blocked  +by process 24817.
        Process 24817 waits for ExclusiveLock on tuple (0,59) of relation 17911 of database 17659;   +blocked by process 19784.
        Process 19784: UPDATE "operatingsystems" SET "hosts_count" = COALESCE("hosts_count", 0) - 1  +WHERE "operatingsystems"."id" = 4
        Process 24817: UPDATE "operatingsystems" SET "hosts_count" = COALESCE("hosts_count", 0) + 1  +WHERE "operatingsystems"."type" IN ('Redhat') AND "operatingsystems"."id" = 4
2016-06-10 10:58:53 CEST HINT:  See server log for query details.
2016-06-10 10:58:53 CEST STATEMENT:  UPDATE "operatingsystems" SET "hosts_count" =                   +COALESCE("hosts_count", 0) - 1 WHERE "operatingsystems"."id" = 4

Looks like this is related:

http://projects.theforeman.org/issues/10133

# rpm -q satellite katello foreman
satellite-6.2.0-14.2.el7sat.noarch
katello-3.0.0-6.el7sat.noarch
foreman-1.11.0.34-1.el7sat.noarch

Debug tarball (Foreman core team permissions needed to download it):
http://debugs.theforeman.org/foreman-debug-0Qsen.tar.xz

I am able to randomly reproduce on my own box, takes hours to hit with about 100 clients registering.

Comment 1 Lukas Zapletal 2016-06-10 12:44:47 UTC
Note: You may need to configure PassengerMinInstances 2 in /etc/httpd/conf.d/05-foreman-ssl.conf in order to have at least two processes that interfere each other.

Comment 4 Chris Duryee 2016-06-15 17:40:06 UTC
I believe this is the same as 1341338. There are a couple of related queries that rely on the same rails locking mechanisms.

*** This bug has been marked as a duplicate of bug 1341338 ***


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