Bug #36835
closedTimeout for "hammer --no-headers erratum list --errata-restrict-applicable 1 --organization-id 1"
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=2244122
Description of problem:
Error via hammer when running the command below
---
hammer d --no-headers erratum list --errata-restrict-applicable 1 --organization-id 1
--
Version-Release number of selected component (if applicable):
Katello 4.5
How reproducible:
100% ~ 7000 errata applicable to 10k hosts
Steps to Reproduce:
1. Create an environment with ~ 7000 errata applicable to 10k hosts (or perhaps reduce the puma worker timeout to be very small)
2. Execute the command
3.
Actual results:
There is an issue as presented below
---
[ERROR 2023-10-13T00:54:08 API] 502 Bad Gateway
[DEBUG 2023-10-13T00:54:08 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=\"/katello/api/errata\">GET /katello/api/errata</a></em>.<p>\nReason: <strong>Error reading from remote server</strong></p></p>\n</body></html>\n"
[DEBUG 2023-10-13T00:54:08 Exception] Using exception handler HammerCLIKatello::ExceptionHandler#handle_general_exception
[ERROR 2023-10-13T00:54:08 Exception] Error: 502 Bad Gateway
Error: 502 Bad Gateway
[ERROR 2023-10-13T00:54:08 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'
---
and on httpd logs
---
[Fri Oct 13 00:54:08.298157 2023] [proxy_http:error] [pid 127044] (20014)Internal error: [client 10.8.29.218:51648] AH01102: error reading status line from remote server httpd-UDS:0
[Fri Oct 13 00:54:08.298467 2023] [proxy:error] [pid 127044] [client 10.8.29.218:51648] AH00898: Error reading from remote server returned by /katello/api/errata
---
Expected results:
The complete report
Additional info:
The issue seems to be that the applicable errata filtering relies too heavily on the web server rather than postgres. The timeout is resolved if duplicate errata entries are made distinct by postgres. See the PR for more info.