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 1324450 - Table lock hangs all processes
Summary: Table lock hangs all processes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Provisioning
Version: 6.0.4
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: Unspecified
Assignee: Marek Hulan
QA Contact: Roman Plevka
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-06 10:59 UTC by Marek Hulan
Modified: 2020-08-13 08:25 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:29:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 10053 0 None None None 2016-04-26 17:07:23 UTC

Description Marek Hulan 2016-04-06 10:59:43 UTC
We have an issue that occurs frequently that causes all available Passenger threads to wait on the database.  In the database there is one query that locks several tables causing a backlog of connections to hang rendering Foreman unresponsive.  The database is MySQL.

This is the query causing the locks.  It's been running for almost 2 hours.

<pre>
SELECT DISTINCT `reports`.id FROM `reports`
LEFT OUTER JOIN `hosts` ON `hosts`.`id` = `reports`.`host_id` AND
`hosts`.`type` IN ('Host::Managed')
LEFT OUTER JOIN `hosts` `hosts_reports_join` ON `hosts_reports_join`.`id` = `reports`.`host_id` AND
`hosts_reports_join`.`type` IN ('Host::Managed')
LEFT OUTER JOIN `environments` ON `environments`.`id` = `hosts_reports_join`.`environment_id`
LEFT OUTER JOIN `logs` ON `logs`.`report_id` = `reports`.`id`
LEFT OUTER JOIN `messages` ON `messages`.`id` = `logs`.`message_id`
LEFT OUTER JOIN `logs` `logs_reports_join` ON `logs_reports_join`.`report_id` = `reports`.`id`
LEFT OUTER JOIN `sources` ON `sources`.`id` = `logs_reports_join`.`source_id`
LEFT OUTER JOIN `hosts` `hosts_reports_join_2` ON `hosts_reports_join_2`.`id` = `reports`.`host_id` AND
`hosts_reports_join_2`.`type` IN ('Host::Managed')
LEFT OUTER JOIN `hostgroups` ON `hostgroups`.`id` = `hosts_reports_join_2`.`hostgroup_id`
WHERE `reports`.`host_id` IN (
  SELECT `hosts`.`id` FROM `hosts`
  WHERE `hosts`.`type` IN ('Host::Managed')) AND
  (((((`reports`.`status` >> 0 & 16777215) > 0)) AND
  (`hosts`.`name` LIKE '%applied%' OR
  `environments`.`name` LIKE '%applied%' OR
  `messages`.`value` LIKE '%applied%' OR
  `sources`.`value` LIKE '%applied%' OR
  `hostgroups`.`name` LIKE '%applied%' OR
  `hostgroups`.`title` LIKE '%applied%' OR
  `hostgroups`.`title` LIKE '%applied%'))
)
ORDER BY `reports`.`reported_at` DESC LIMIT 150 OFFSET 0
</pre>

These are the last entries in the production.log.

<pre>
Started POST "/api/reports" for 10.48.184.55 at 2015-04-07 15:35:28 +0000
Processing by Api::V2::ReportsController#create as JSON
  Parameters: {"report"=>"[FILTERED]", "apiv"=>"v2"}
processing report for lvsdevwsv02-01.us.gspt.net
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
Connecting to database specified by database.yml
Connecting to database specified by database.yml
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
Creating scope :completer_scope. Overwriting existing method Organization.completer_scope.
Creating scope :completer_scope. Overwriting existing method Location.completer_scope.
</pre>

Comment 1 Marek Hulan 2016-04-06 10:59:45 UTC
Created from redmine issue http://projects.theforeman.org/issues/10053

Comment 2 Marek Hulan 2016-04-06 10:59:49 UTC
Upstream bug assigned to mhulan

Comment 4 Bryan Kearney 2016-04-07 14:06:46 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10053 has been closed
-------------
Marek Hulán
Applied in changeset commit:2f1cc0f4b8e8d320e8eef309b1ab7c834b201dce.

Comment 6 Roman Plevka 2016-07-12 14:07:35 UTC
VERIFIED
on sat6.2 snap19.1

The 2 fields are now excluded from search until explicitly included:

# hammer report list --search='log~"Triggered"'
[Foreman] Password for admin: 
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
ID | HOST                                       | LAST REPORT         | APPLIED | RESTARTED | FAILED | RESTART FAILURES | SKIPPED | PENDING
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
11 | my-host-1 | 2016/07/11 12:56:33 | 24      | 26        | 0      | 0                | 0       | 0      
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
[root var]# hammer report list --search='"Triggered"'
[Foreman] Password for admin: 
---|------|-------------|---------|-----------|--------|------------------|---------|--------
ID | HOST | LAST REPORT | APPLIED | RESTARTED | FAILED | RESTART FAILURES | SKIPPED | PENDING
---|------|-------------|---------|-----------|--------|------------------|---------|--------
[root var]# hammer report list --search='resource~"Puppet"'
[Foreman] Password for admin: 
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
ID | HOST                                       | LAST REPORT         | APPLIED | RESTARTED | FAILED | RESTART FAILURES | SKIPPED | PENDING
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
11 | my-host-1 | 2016/07/11 12:56:33 | 24      | 26        | 0      | 0                | 0       | 0      
1  | my-host-1 | 2016/07/11 10:54:41 | 0       | 0         | 0      | 0                | 0       | 0      
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
[root var]# hammer report list --search='"Puppet"'
[Foreman] Password for admin: 
---|------|-------------|---------|-----------|--------|------------------|---------|--------
ID | HOST | LAST REPORT | APPLIED | RESTARTED | FAILED | RESTART FAILURES | SKIPPED | PENDING
---|------|-------------|---------|-----------|--------|------------------|---------|--------
[root var]# 
[root var]# hammer report list --search='pending=0'
[Foreman] Password for admin: 
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
ID | HOST                                       | LAST REPORT         | APPLIED | RESTARTED | FAILED | RESTART FAILURES | SKIPPED | PENDING
---|--------------------------------------------|---------------------|---------|-----------|--------|------------------|---------|--------
62 | my-host-1 | 2016/07/12 13:54:41 | 0       | 0         | 0      | 0                | 0       | 0      
61 | my-host-1 | 2016/07/12 13:54:24 | 0       | 0         | 0      | 0                | 0       | 0      
60 | my-host-1 | 2016/07/12 13:24:41 | 0       | 0         | 0      | 0                | 0       | 0

Comment 7 Bryan Kearney 2016-07-27 11:29:32 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/RHBA-2016:1501


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