Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2018 21:31:22 +0000
From:      Marcin Cieslak <saper@saper.info>
To:        =?ISO-8859-15?Q?Karli_Sj=F6berg?= <karli@inparadise.se>
Cc:        ports@freebsd.org, ruby@freeebsd.org
Subject:   Re: monitoring ruby app memory usage with passenger-recycler (was: Cannot require library for passenger in ruby)
Message-ID:  <nycvar.OFS.7.76.6.1802202034350.2659@z.fncre.vasb>

next in thread | raw e-mail | index | archive | help
--1563967779-917225932-1519162282=:2659
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8BIT

On Mon, 19 Feb 2018, Karli Sjöberg wrote:

> > What is the tool you are trying to deploy? foreman_maintain?

Sorry, I was too quick. This foreman_main is used to download/update foreman
from RedHat Satellite servers, which is not what you want.

However, the passenger-recycler script is a standalone script which
could possibly used with this little fix:

https://github.com/theforeman/foreman_maintain/pull/143

To apply this, please add files/patch-bin_passenger-recycler in the port I've sent before:

--- bin/passenger-recycler.orig 2018-02-20 21:09:18 UTC
+++ bin/passenger-recycler
@@ -41,10 +41,10 @@ def process_status?(pid)
 end
 
 require 'phusion_passenger'
+PhusionPassenger.locate_directories
 require 'phusion_passenger/platform_info'
 require 'phusion_passenger/platform_info/ruby'
 require 'phusion_passenger/admin_tools/memory_stats'
-PhusionPassenger.locate_directories
 stats = PhusionPassenger::AdminTools::MemoryStats.new
 unless stats.platform_provides_private_dirty_rss_information?
   puts 'Please run as root or platform unsupported'


But the real problem is that Passenger does think it supports
getting process private dirty RSS memory information only on Linux:

https://github.com/phusion/passenger/blob/219ad24159ae4033a342e6ad753cfee05d98bae0/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb#L121

In file src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb:

120       def platform_provides_private_dirty_rss_information?
121         return os_name_simple == "linux"
122       end

This support probably would need to be written. So, unfortunately, passenger-recycler
as written will exit with:

	Please run as root or platform unsupported

But passenger-recycler does something very simple - if the amount of "private resident RSS
memory" is higher than specified amount in the configuration file, it kills the process.

You might get a much better monitoring on FreeBSD by monitoring the output of

procstat -v <processid>

which will give you details about the memory usage of the process and see how it is growing
over time. Maybe you can pinpoint the shared library that causes this, if you are lucky.

Marcin
--1563967779-917225932-1519162282=:2659
Content-Type: application/pkcs7-signature; name=smime.p7s
Content-Transfer-Encoding: BASE64
Content-Description: S/MIME Cryptographic Signature
Content-Disposition: attachment; filename=smime.p7s

MIIOSwYJKoZIhvcNAQcCoIIOPDCCDjgCAQExDzANBglghkgBZQMEAgEFADAL
BgkqhkiG9w0BBwGgggqQMIIElzCCA3+gAwIBAgIOSBtqCKJEiNNcmz3JSA0w
DQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xvYmFsU2lnbiBSb290IENB
IC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2JhbFNp
Z24wHhcNMTYwNjE1MDAwMDAwWhcNMjQwNjE1MDAwMDAwWjBdMQswCQYDVQQG
EwJCRTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTEzMDEGA1UEAxMqR2xv
YmFsU2lnbiBQZXJzb25hbFNpZ24gMSBDQSAtIFNIQTI1NiAtIEczMIIBIjAN
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyrCba00KOKyGuwh9h+/MAcZm
ZUF9OxGKA56AADHaDE08rB0WEbgm6J4XvJP3OGQ7cgHdVJu6XMZkRd6EcfjD
yRrIwE6oAVWJe57co3gKk/XxvuubSZuUahrcOiv3D2qaHwva4zumubxQQI4f
unEzRIJHPiNjaq0cCcZsMcp5pxsEz8aG0sr8Oh80sxKNnzPmuUETLESktfMC
pQKHUGmWXLsG6sgCZOezUjDjKpPKW7l4PUt0TEBEyqLhifv9/YPn5C4o10PP
daDazZPeKNif2PVQ5u0HRnkFrHh4wmmrMtY22Mse3eR01gD6rEEGWf+gdzuy
EQE+ZVlNhCP4gXjdBQIDAQABo4IBZDCCAWAwDgYDVR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MDIyMDIxMzEyMlowLwYJKoZIhvcN
AQkEMSIEIAU36l9Xdldjw64pYsWkZRxN/QCSHHKw5PON7eURQOZoMHkGCSqG
SIb3DQEJDzFsMGowCwYJYIZIAWUDBAEqMAsGCWCGSAFlAwQBFjALBglghkgB
ZQMEAQIwCgYIKoZIhvcNAwcwDgYIKoZIhvcNAwICAgCAMA0GCCqGSIb3DQMC
AgFAMAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEoMA0GCSqGSIb3DQEBAQUABIIC
AEGG23uaH+1F9lQJA4etA7bHs75GvBlmHkv8W+bBDf15t7blQKf1sP3WLjiY
Yx0Zcgrctfie/baRFJkOoAU3rT3UxbDS+waJQYS0d4AFlHfAza+Xov1a0PmO
GUbYnfrA8ot2V/I0GQh/xW9btwI47acy3Rr1NFDxtyjjqrla035CVfUDS9LW
QQVuYJNJ7ptXimluTeKObIlsi6ijObCCoEt2DEu4DMpjH/z99L+HroEGvsRj
Dkl7uHEj98oPyOVOegQhDu9454WtcebciuRCgnva3xL8z2/RVGzjBSaO4PdR
4UT1+SWEO1dGm+MocpU9cgE/HYLkbpbyvtRkw5i1ymL6La1ehT1eaa9fGub7
1qXkxeUazQVfAYus45EwzEWs5rTL3Kck5xE3vnVrCrkDiD9fam4PglfqxpYp
Haf21y+xdBAREpcJ1GJeBRh4VshZ9U6MpfDJP1s3zRmVn6GDbRvrXWwi0AzB
5iA4AX+NFCKdg+jZN6cqL34o+1Yg+O8narLSpMaPFBGEAxI20JlumRcGPnnU
GhiU9BsCsl8FEeTlU5O442V4g+wtp/tBrGRRvwYEWyWOV/lUyeHSkztXhi6n
CE7tCg+81Zz174KjjQIp13G5H32ujHBhFi7gJdV69hAriXmtRRS/B1kd5Zxq
jmJrFDkN57zg1os17nMMhdhp

--1563967779-917225932-1519162282=:2659--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?nycvar.OFS.7.76.6.1802202034350.2659>