Bug 1215285

Summary: Requiring less gem added 500mb to worker VIRT memory
Product: Red Hat CloudForms Management Engine Reporter: Dave Johnson <dajohnso>
Component: ApplianceAssignee: Joe Rafaniello <jrafanie>
Status: CLOSED ERRATA QA Contact: Milan Falešník <mfalesni>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.4.0CC: abellott, cpelland, jhardy, mfalesni, obarenbo
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-16 13:00:13 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 Dave Johnson 2015-04-24 22:27:59 UTC
Description of problem:
===================================
I noticed VIRT memory on worker processes is much larger than it was on 5.3.z appliances.  I spoke to LJ about it who tracked it down to the addition of the less gem


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


How reproducible:
=====================================
100%


Steps to Reproduce:
===================================
1.  run an appliance
2.  run 'top'
3.  compare results with a 5.3 appliance.


Actual results:
=============================

some 5.4 appliance worker processes (VIRT is column 5)
---------------------------------------
 4615 root      20   0  993m 174m 3172 R  8.0  3.0 141:19.38 ruby                                                                                                                      
25842 root      23   3  990m 270m 9392 S  0.0  4.6  20:35.25 ruby                                                                                                                      
some 5.3 appliance worker processes (VIRT is column 5)
---------------------------------------
 4951 root      23   3  499m 332m 6888 S  0.0  5.7 170:58.94 ruby                                                                                                                      
 4651 root      20   0  432m 206m 6284 S  1.6  3.5 167:44.15 ruby

Comment 3 Joe Rafaniello 2015-04-27 18:30:21 UTC
Upstream pull request: https://github.com/ManageIQ/manageiq/pull/2758

Comment 4 CFME Bot 2015-04-28 15:01:15 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/80b683f50c00ee2222d0c75c24a29424f1b69409

commit 80b683f50c00ee2222d0c75c24a29424f1b69409
Author:     Joe Rafaniello <jrafanie>
AuthorDate: Mon Apr 27 11:23:17 2015 -0400
Commit:     Joe Rafaniello <jrafanie>
CommitDate: Mon Apr 27 14:18:08 2015 -0400

    Don't eager require therubyracer/less-rails
    
    require 'less' by itself consumes 500+ MB of virtual memory per process.
    However, we only need less/less-rails to precompile less assets into css.
    In production mode, we should have all of the less assets precompiled so
    there's no need to take this 500 MB hit.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1215285

 vmdb/Gemfile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comment 5 Joe Rafaniello 2015-04-28 15:39:21 UTC
Some more diagnostics: https://gist.github.com/jrafanie/a6d5066216ab89e54ece

Comment 7 Milan Falešník 2015-05-07 08:53:06 UTC
Verified in 5.4.0.0.25.

After putting evmserverd to stop, patching the lib/util/require_with_logging.rb with memory output printing, I ran the command as mentioned in the gist and there was no memory jump after including sprockets/less, which is the only mention about less I could find in the report. No mention of v8 too.

I also checked the memory usage in htop, the highest virtual memory consumption of any EVM process was ~415M.

Comment 9 errata-xmlrpc 2015-06-16 13:00:13 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://rhn.redhat.com/errata/RHBA-2015-1100.html