Problem:
Memory consumption increases during GET operation and is not released after it is completed.
I, [2019-01-23T10:04:24.884357 ] INFO – : 10.15.0.231 - - [23/Jan/2019:10:04:24 +0000] “GET /puppet/environments/ITOP2242/classes HTTP/1.1” 200 212982 34.8761
I, [2019-01-23T10:04:25.116733 ] INFO – : 10.15.0.231 - - [23/Jan/2019:10:04:25 +0000] “GET /puppet/environments/ITOP2242/classes HTTP/1.1” 200 212982 95.3287
[root@hostname# uname -a
Linux hostname 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[e.g. logs from Foreman and/or the Proxy, modified templates, commands issued, etc]
(for logs, surround with three back-ticks to get proper formatting, e.g.)
Upgrade to the latest version to see if the problem persists.
Ruby never returns memory back to the OS, but eventually GC should collect and claim some memory. Can you put memory consumption into some monitoring and get out graph out of it? Does the consumption stabilize at some point (normal) or does it grow forever (abnormal)?
Many thanks for reply. Will try to get a graph out today.
Ultimately we are looking at upgrading and I was just wondering if anyone has seen this before.
Currently we are controlling it with foreman-proxy service restarts.
About the modular retrievers - where can I find them?
Depending on Puppet Master version, we use two different implementations. One implementation does use some kind of cache, search for *_cache attributes. These seem to be hash and not LRU, so chances are if you have many classes which are changing those hashes are increasing incrementally eating lot of memory. This is my wild guess.
As systems are live I did not have a chance to simulate the problem but I will try to build small lab.
Many thanks again I will have a look at the links.
it seems that we are using V3
[root@hostname puppet_proxy_puppet_api]# ls -ltr
total 32
-rw-r–r--. 1 root root 378 Oct 10 2017 v3_environments_retriever.rb
-rw-r–r--. 1 root root 4879 Oct 10 2017 v3_environment_classes_api_classes_retriever.rb
-rw-r–r--. 1 root root 1424 Oct 10 2017 v3_classes_retriever.rb
-rw-r–r--. 1 root root 1393 Oct 10 2017 v3_api_request.rb
I have improved the patch, while I was working on the debug logging I noticed that entries are not actually removed from cache hash, so refactored this to delete. This could help in some cases.