This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2160801 - report template is blowing up after 15 min (Error: 502 Bad Gateway)
Summary: report template is blowing up after 15 min (Error: 502 Bad Gateway)
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Reporting
Version: 6.11.0
Hardware: All
OS: All
unspecified
high
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-13 18:23 UTC by Waldirio M Pinheiro
Modified: 2024-06-06 16:05 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 16:05:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   SAT-20175 0 None Migrated None 2024-06-06 16:04:59 UTC

Description Waldirio M Pinheiro 2023-01-13 18:23:00 UTC
Description of problem:
When generating a custom report template that is basically collecting facts, setting properly the timeout to "-1", after 15 min we can see the error "Error: 502 Bad Gateway".

After a lot of different settings, tuning and tricks, the behavior is still the same.

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

How reproducible:
100%

Steps to Reproduce:
1. Create the custom report template with the content below
2. Generate the report template, via webUI or hammer
3.

Actual results:
after 15 min, we can see the error

Expected results:
Generate the report with no issues

Additional info:

Comment 1 Waldirio M Pinheiro 2023-01-13 18:34:45 UTC
Hello,

Here we can see the current scenario

---
32vcpu
128GiB
extra-large profile
~16.5k Content Hosts
---


1. First, let's update the hammer configuration in order to remove the timeout
	---
	# cat ~/.hammer/cli.modules.d/foreman.yml 
	:foreman:
	  # Credentials. You'll be asked for the interactively if you leave them blank here
	  :username: 'admin'
	  :password: 'redhat'

	  # Check API documentation cache status on each request
	  :refresh_cache: false

	  # API request timeout in seconds, set -1 for infinity
	  :request_timeout: -1   # <<< This is the setting that will remove the timeout
	  #:request_timeout: 120
	---


2. Now, let's create the report
	---
	<%- load_hosts(search: input('server')).each_record do |host| -%>
	<%-   report_row(
			'FQDN': host.name,
			'IP': host.ip,
			'Org': host.organization,
			'BaseOS': host.facts['distribution::name'],
			'Version': host.facts['distribution::version'],
			'Vendor': host.facts['dmi::bios::vendor'],
			'Product Name': host.facts['dmi::system::product_name'],
			'Last Boot': host.facts['last_boot'],
			'Last Checkin': last_checkin(host).to_s
		  ) -%>
	<%- end -%>
	<%= report_render -%>
	---

	Note. When filtering the server, the report got generated correctly. However, when pushing to generate the complete list, after ~15 min we can see the error as presented below
	

# The error


	---
	# time hammer -d report-template generate --id 292 --path /root/inventory1/
	...
	[ INFO 2023-01-13T01:58:46 HammerCLIForeman::ReportTemplate::GenerateCommand] Called with options: {"option_id"=>"292", "option_path"=>"/root/inventory1/"}
	[ INFO 2023-01-13T01:58:46 API] Server: https://server_fqdn_here
	[ INFO 2023-01-13T01:58:46 API] POST /api/report_templates/292/generate
	[DEBUG 2023-01-13T01:58:46 API] Params: {
		"input_values" => {}
	}
	[DEBUG 2023-01-13T01:58:46 API] Headers: {}
	[DEBUG 2023-01-13T01:58:46 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
	[ERROR 2023-01-13T02:13:46 API] 502 Bad Gateway
	[DEBUG 2023-01-13T02:13:46 API] "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>502 Proxy Error</title>\n</head><body>\n<h1>Proxy Error</h1>\n<p>The proxy server received an invalid\r\nresponse from an upstream server.<br />\r\nThe proxy server could not handle the request <em><a href=\"/api/report_templates/292/generate\">POST&nbsp;/api/report_templates/292/generate</a></em>.<p>\nReason: <strong>Error reading from remote server</strong></p></p>\n</body></html>\n"
	[DEBUG 2023-01-13T02:13:46 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_general_exception
	[ERROR 2023-01-13T02:13:46 Exception] Error: 502 Bad Gateway
	Error: 502 Bad Gateway
	[ERROR 2023-01-13T02:13:46 Exception] 

	RestClient::BadGateway (502 Bad Gateway):
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:223:in `exception_with_response'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:103:in `return!'
		/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:807:in `process_result'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:725:in `block in transmit'
		/opt/rh/rh-ruby27/root/usr/share/ruby/net/http.rb:933:in `start'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'
		/opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.2/lib/restclient/resource.rb:67:in `post'
		/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:327:in `call_client'
		/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:240:in `http_call'
		/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:190:in `call_action'
		/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.4.0/lib/apipie_bindings/api.rb:185:in `call'
		/opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.4.0/lib/apipie_bindings/resource.rb:21:in `call'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-3.1.0.1/lib/hammer_cli/apipie/command.rb:53:in `send_request'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-3.1.0.1/lib/hammer_cli_foreman/commands.rb:180:in `send_request'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-3.1.0.1/lib/hammer_cli_foreman/commands.rb:744:in `execute'
		/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-3.1.0.1/lib/hammer_cli/abstract.rb:103:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
		/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-3.1.0.1/lib/hammer_cli/abstract.rb:103:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
		/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-3.1.0.1/lib/hammer_cli/abstract.rb:103:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
		/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-3.1.0.1/bin/hammer:147:in `<top (required)>'
		/usr/bin/hammer:23:in `load'
		/usr/bin/hammer:23:in `<main>'



	real	15m9.227s
	user	0m2.763s
	sys	0m0.623s
	[root@xsvcsatm2p ~]#
	---



3. Tuning

Some additional tuning were made. However, it is still the same behavior

	// kernel
	---
	# sysctl -a | grep somaxcon
	net.core.somaxconn = 128

	sysctl -w net.core.somaxconn=1024
	systemctl daemon-reload
	systemctl restart foreman.socket foreman
	---


	// Before
	---
	[root@xsvcsatm2p ~]# ss -l | grep foreman
	u_str  LISTEN     0      128    /run/foreman.sock 17981                 * 0                    
	u_str  LISTEN     0      1024   /usr/share/foreman/tmp/sockets/pumactl.sock 227940                * 0
	---

	// After
	---
	u_str  LISTEN     0	 1024   /usr/share/foreman/tmp/sockets/pumactl.sock 308352                * 0
	u_str  LISTEN     0	 1024   /run/foreman.sock 265725                * 0
	---

	Reference: https://bugzilla.redhat.com/show_bug.cgi?id=2022240



	// Apache
	---
	Edit /etc/httpd/conf.d/05-foreman-ssl.conf and /etc/httpd/conf.d/05-foreman.conf and add SetEnv proxy-initial-not-pooled 1 line just after ProxyPassReverse entry for foreman.sock.

	Example:

	ProxyPassReverse / unix:///run/foreman.sock|http://satelllite.example.com/
	SetEnv proxy-initial-not-pooled 1
	---

	Reference: https://access.redhat.com/solutions/6507661



With the tuning above, we still facing the same behavior as well.


Your help here will be appreciated.
Waldirio

Comment 5 Eric Helms 2024-06-06 16:05:00 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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