Bug 1396349

Summary: Timeout with 500 Internal Server error when loading the puppetclasses page
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: PuppetAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: high    
Version: 6.2.0CC: anerurka, bbuckingham, jcallaha, ohadlevy
Target Milestone: UnspecifiedKeywords: Performance, 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: Environment:
Last Closed: 2016-11-28 07:48:09 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 Hao Chang Yu 2016-11-18 06:56:56 UTC
Description of problem:

When the satellite server has large number of content views with puppet modules, it will take extremely long time to load the puppetclasses page and then timeout with 500 internal server error after about 3+ minutes of waiting.


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

How reproducible:
Create 25++ content views and add a couple of puppet modules to them, such as puppetlab/motd and puppetlab/apache, and then publish them.


Steps to Reproduce:
1. Visit /environments page
2. then click the classes button 
3. Wait for a few minutes until the browser returns 500 internal Server Error.

Actual results:
500 internal server error.

Expected results:
The page should show a list of puppet classes.


Additional info:

Comment 1 Hao Chang Yu 2016-11-18 07:05:09 UTC
More info:

The request stuck in the following query. As you can see, the query took more than a minute to execute possibly due to inefficient sql query.


2016-11-18 17:01:19 [sql] [D]   SQL (65800.6ms)  SELECT "puppetclasses"."id" AS t0_r0, "puppetclasses"."name" AS t0_r1, "puppetclasses"."created_at" AS t0_r2, "puppetclasses"."updated_at" AS t0_r3, "puppetclasses"."total_hosts" AS t0_r4, "puppetclasses"."global_class_params_count" AS t0_r5, "puppetclasses"."variable_lookup_keys_count" AS t0_r6, "environments"."id" AS t1_r0, "environments"."name" AS t1_r1, "environments"."created_at" AS t1_r2, "environments"."updated_at" AS t1_r3, "environments"."katello_id" AS t1_r4, "environments"."hosts_count" AS t1_r5, "environments"."hostgroups_count" AS t1_r6, "config_group_classes"."id" AS t2_r0, "config_group_classes"."puppetclass_id" AS t2_r1, "config_group_classes"."config_group_id" AS t2_r2, "config_group_classes"."created_at" AS t2_r3, "config_group_classes"."updated_at" AS t2_r4, "lookup_keys"."id" AS t3_r0, "lookup_keys"."key" AS t3_r1, "lookup_keys"."created_at" AS t3_r2, "lookup_keys"."updated_at" AS t3_r3, "lookup_keys"."puppetclass_id" AS t3_r4, "lookup_keys"."default_value" AS t3_r5, "lookup_keys"."path" AS t3_r6, "lookup_keys"."description" AS t3_r7, "lookup_keys"."validator_type" AS t3_r8, "lookup_keys"."validator_rule" AS t3_r9, "lookup_keys"."key_type" AS t3_r10, "lookup_keys"."override" AS t3_r11, "lookup_keys"."required" AS t3_r12, "lookup_keys"."lookup_values_count" AS t3_r13, "lookup_keys"."merge_overrides" AS t3_r14, "lookup_keys"."avoid_duplicates" AS t3_r15, "lookup_keys"."use_puppet_default" AS t3_r16, "lookup_keys"."type" AS t3_r17, "lookup_keys"."merge_default" AS t3_r18, "lookup_keys"."hidden_value" AS t3_r19, "hostgroups"."id" AS t4_r0, "hostgroups"."name" AS t4_r1, "hostgroups"."created_at" AS t4_r2, "hostgroups"."updated_at" AS t4_r3, "hostgroups"."environment_id" AS t4_r4, "hostgroups"."operatingsystem_id" AS t4_r5, "hostgroups"."architecture_id" AS t4_r6, "hostgroups"."medium_id" AS t4_r7, "hostgroups"."ptable_id" AS t4_r8, "hostgroups"."root_pass" AS t4_r9, "hostgroups"."puppet_ca_proxy_id" AS t4_r10, "hostgroups"."use_image" AS t4_r11, "hostgroups"."image_file" AS t4_r12, "hostgroups"."ancestry" AS t4_r13, "hostgroups"."vm_defaults" AS t4_r14, "hostgroups"."subnet_id" AS t4_r15, "hostgroups"."domain_id" AS t4_r16, "hostgroups"."puppet_proxy_id" AS t4_r17, "hostgroups"."title" AS t4_r18, "hostgroups"."realm_id" AS t4_r19, "hostgroups"."compute_profile_id" AS t4_r20, "hostgroups"."content_source_id" AS t4_r21, "hostgroups"."grub_pass" AS t4_r22, "hostgroups"."content_view_id" AS t4_r23, "hostgroups"."lifecycle_environment_id" AS t4_r24, "hostgroups"."lookup_value_matcher" AS t4_r25, "hostgroups"."hosts_count" AS t4_r26, "hostgroups"."kickstart_repository_id" AS t4_r27, "hostgroups"."openscap_proxy_id" AS t4_r28 FROM "puppetclasses" LEFT OUTER JOIN "environment_classes" ON "environment_classes"."puppetclass_id" = "puppetclasses"."id" LEFT OUTER JOIN "environments" ON "environments"."id" = "environment_classes"."environment_id" AND "environments"."id" IN (14, 25, 27, 8, 12, 17, 1, 15, 10, 26, 11, 4, 18, 20, 5, 13, 22, 9, 7, 16, 24, 6, 19, 2, 21, 23) LEFT OUTER JOIN "config_group_classes" ON "config_group_classes"."puppetclass_id" = "puppetclasses"."id" LEFT OUTER JOIN "environment_classes" "environment_classes_puppetclasses_join" ON "environment_classes_puppetclasses_join"."puppetclass_id" = "puppetclasses"."id" LEFT OUTER JOIN "lookup_keys" ON "lookup_keys"."id" = "environment_classes_puppetclasses_join"."puppetclass_lookup_key_id" AND "lookup_keys"."type" IN ('PuppetclassLookupKey') AND (environment_classes.puppetclass_lookup_key_id is NOT NULL) LEFT OUTER JOIN "hostgroup_classes" ON "hostgroup_classes"."puppetclass_id" = "puppetclasses"."id" LEFT OUTER JOIN "hostgroups" ON "hostgroups"."id" = "hostgroup_classes"."hostgroup_id" AND "hostgroups"."id" IN (2) WHERE (("puppetclasses"."id" IN (SELECT "puppetclasses"."id" FROM         "puppetclasses"
 |         INNER JOIN "environment_classes"
 |         ON "puppetclasses"."id" = "environment_classes"."puppetclass_id" 
 |         INNER JOIN "environments"
 |         ON "environment_classes"."environment_id" = "environments"."id" 
 |  WHERE "environments"."name" = 'KT_hao_gss_Library_hao_content_view_10_12' ))) AND "puppetclasses"."id" IN (33, 29)  ORDER BY puppetclasses.name

Comment 4 Ohad Levy 2016-11-28 07:48:09 UTC

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