Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppet Agent 7.33.0 problem with Ruby memory bloat #2561

Open
hpoznanski opened this issue Oct 17, 2024 · 1 comment
Open

Puppet Agent 7.33.0 problem with Ruby memory bloat #2561

hpoznanski opened this issue Oct 17, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@hpoznanski
Copy link

Describe the Bug

After upgrading puppet agent to version 7.33.0, we noticed a problem with ruby memory release. It appears to be a memory bloat. It does not occur on all nodes in our stack or at least it is hardly noticeable.

Expected Behavior

Releasing memory at some time interval.

Steps to Reproduce

Steps to reproduce the behavior:
Upgrade puppet version to 7.33.0 (with ruby 2.7.8p225 (2023-03-30 revision 1f4d455848) [x86_64-linux])

Environment

  • Version: Puppet Agent: 7.33.0, ruby 2.7.8p225 (2023-03-30 revision 1f4d455848) [x86_64-linux]
  • Platform: Rocky Linux 9.4 (5.14.0-362.24.1.el9_3.cloud.0.6.x86_64)
image
@hpoznanski hpoznanski added the bug Something isn't working label Oct 17, 2024
@joshcooper
Copy link
Contributor

@hpoznanski do you see this behavior with other puppet-agent versions or just 7.33.0? I'd suggest running puppet in a memory profiler to capture details. This can be done by modifying the puppet bin wrapper like

--- a/bin/puppet
+++ b/bin/puppet
@@ -1,10 +1,19 @@
 #!/usr/bin/env ruby
 # frozen_string_literal: true
 
+require 'memory_profiler'
+
 begin
   require 'puppet/util/command_line'
+  MemoryProfiler.start
   Puppet::Util::CommandLine.new.execute
 rescue LoadError => e
   $stderr.puts e.message
   exit(1)
+ensure
+  report = MemoryProfiler.stop
+  puts "writing /tmp/puppet.prof"
+  File.open('/tmp/puppet.prof', 'w') do |f|
+    report.pretty_print(f)
+  end
 end

Then run /opt/puppetlabs/puppet/bin/gem install memory_profiler and restart the agent. Let it run for a while and stop the service. It will generate a memory profile in the tmp directory identifying which objects are still reachable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants