Bug 1565373

Summary: Unable to modify a Provisioning Template when many Host Group are associated to it.
Product: Red Hat Satellite Reporter: Christian Marineau <cmarinea>
Component: Provisioning TemplatesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Roman Plevka <rplevka>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: mhulan, mmccune, mpusater, oprazak, phess, pmoravec, rbeyel
Target Milestone: ReleasedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-02-16 16:33:20 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:
Attachments:
Description Flags
template combinations none

Description Christian Marineau 2018-04-09 23:52:21 UTC
Description of problem:
-----------------------
When many Host Groups  have been associated to a Provisioning Templates by using "Add combination", the Provisioning Template is impossible to save and throws the following Error:
  ---
  Internal Server Error
  The server encountered an internal error or misconfiguration and was unable to complete your request.
  Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
  More information about this error may be available in the server error log.
  ---


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


How reproducible:
-----------------
100%


Steps to Reproduce:
-------------------
1. Create a New Operating System, so we do not need to alter the working ones.
   Select  x86_64 as architecture

2. Create a test provisioning template, by example you may clone "Satellite Kickstart Default" to "0_Test". 
   Associate this test template to the newly created test Operating System, as well as the proper Organization and Location

3. Edit the Operating System to make sure to change the Provisioning template from "Satellite Kickstart Default" to "O_Test"

3. From the shell on Satellite server
   3.1 Set the variables according to your environment
       -Organization
        # hammer organization list
        # org_id="1"
  
       -Operating system
        # hammer os list
        # os_id="9"

   3.2 Create 60 HostGroups
       # for i in $(seq 1 60); do hammer hostgroup create --name "HG_Test_$i" --architecture-id 1 --operatingsystem-id $os_id --organization-ids $org_id; done   

4. Add combinations
   From the WebUI, edit the provisioning template to add as much Host Groups as possible under "Association" (setting the Environment is not required) and click on Submit.
   
5. Reload the Provisioning Template and click on "Submit", it will throw the following error in the WebUI:
  ---
  Internal Server Error
  The server encountered an internal error or misconfiguration and was unable to complete your request.
  Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
  More information about this error may be available in the server error log.
  ---

Actual results:
---------------
A. From the WebUI the following is experienced:
  ---
  Internal Server Error
  The server encountered an internal error or misconfiguration and was unable to complete your request.
  Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
  More information about this error may be available in the server error log.
  ---

B. From /var/log/foreman/production.log, no error are seen but a entry for each combination can be noticed:
  ---
  [...]
  2018-04-09 17:01:30 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (9.0ms)
  2018-04-09 17:01:30 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (9.3ms)
  2018-04-09 17:01:30 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (8.5ms)
  2018-04-09 17:01:30 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (8.0ms)
  2018-04-09 17:01:31 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (8.4ms)
  2018-04-09 17:01:31 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (8.3ms)
  2018-04-09 17:01:31 8736f6c5 [app] [I]   Rendered 
  provisioning_templates/_combination.html.erb (8.0ms)
  [...]
  ---

C. From /var/log/httpd/error_log the following error is thrown:
   [...]
   [ 2018-04-09 23:28:12.2261 49366/7f42ad5ee700 Pool2/Implementation.cpp:1274 ]: [App 77156 stderr] [ 2018-04-09 23:28:12.2258 77232/0x0000000005aa0d70(Worker 1) utils.rb:74 ]: *** Exception 
   Rack::Multipart::MultipartPartLimitError in Rack application object (Too many open files - Maximum file multiparts in content reached) (process 77232, thread 0x0000000005aa0d70(Worker 1)):
   [ 2018-04-09 23:28:12.2261 49366/7f42ad5ee700 Pool2/Implementation.cpp:1274 ]: [App 77156 stderr]       from /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/multipart/parser.rb:58:in `block in parse'
   [ 2018-04-09 23:28:12.2261 49366/7f42ad5ee700 Pool2/Implementation.cpp:1274 ]: [App 77156 stderr]       from /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/multipart/parser.rb:56:in `loop'
   [ 2018-04-09 23:28:12.2261 49366/7f42ad5ee700 Pool2/Implementation.cpp:1274 ]: [App 77156 stderr]       from /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/multipart/parser.rb:56:in `parse'
   [ 2018-04-09 23:28:12.2261 49366/7f42ad5ee700 Pool2/Implementation.cpp:1274 ]: [App 77156 stderr]       from /opt/rh/rh-ror42/root/usr/share/gems/gems/rack-1.6.2/lib/rack/multipart.rb:25:in `parse_multipart'
   [...]

  
Expected results:
-----------------
Do not have such en error, or set a limit of possible combination with a warning to the user.


Additional info:
----------------
The issue was not happening prior to Satellite 6.3.0 and the issue is now happening most likely because of a change in 
/usr/share/gems/gems/rack-1.6.4/lib/rack/multipart/parser.rb

In /usr/share/gems/gems/rack-1.6.4/lib/rack/multipart/parser.rb, we can see there is a new limit defined:
  "raise MultipartPartLimitError, 'Maximum file multiparts in content reached' if opened_files >= Utils.multipart_part_limit"

Comment 2 Ondřej Pražák 2018-09-12 10:12:09 UTC
Created attachment 1482615 [details]
template combinations

This seems to be fixed in 6.4, I added 60 hostgroups into template combinations but the template saved without any errors.

Could QE verify?

Comment 4 Pavel Moravec 2019-01-05 13:49:10 UTC
/me can confirm the fix - for >50 items of SC params overriden values (Configure -> Smart class parameters -> select some -> big list of matches).

Bug seen in 6.3, not reproducible in 6.4.1

Comment 6 Mike McCune 2019-02-16 16:33:20 UTC
We are going to close this out as CURRENTRELEASE as we have multiple reports of this working fine with 6.4.1 and later.

Engineering does not have the exact commit that resolved this issue so there is nothing available directly to backport this to 6.3. If anyone is experiencing this issue on 6.3 or earlier an upgrade to 6.4 is required.