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

Memory Leak when passing ca_file to Net::HTTP in a custom function #2865

Open
mafgh opened this issue Jul 1, 2024 · 0 comments
Open

Memory Leak when passing ca_file to Net::HTTP in a custom function #2865

mafgh opened this issue Jul 1, 2024 · 0 comments
Labels

Comments

@mafgh
Copy link

mafgh commented Jul 1, 2024

Describe the Bug

There is a memory leak when using Net::HTTP with ca_file to access a https:// URL in a custom function.

Removing the ca_file parameter, the leak is no longer visible.

Expected Behavior

No memory leak.

Steps to Reproduce

Call something like this in a manifest:

    require 'net/http'
    require 'uri'
    
    module Puppet::Parser::Functions
            newfunction(:foo, :type => :rvalue)) do |args|
                    uri = URI('https://foo.com')
    
                    response = Net::HTTP.start(uri.hostname, uri.port,
                            :use_ssl => true,
                            :verify_mode = OpenSSL::SSL::VERIFY_PEER,
                            :ca_file => '/etc/pki/tls/certs/ca-bundle.trust.crt',
                    ) do |http|
                            http.request(request)
                    end
    
                    return ""
            end
    end                                                                                                      

Environment

RHEL9

puppet-agent-8.6.0-1.el9.x86_64
puppetdb-8.5.0-1.el9.noarch
puppetdb-termini-8.5.0-1.el9.noarch
puppetserver-8.6.1-1.el9.noarch

openjdk 17.0.9 2023-10-17 LTS

Additional Context

I found https://bugs.ruby-lang.org/issues/15082#note-5, however I don't know if it's related.

The setup has 73 Agents, all with default runinterval. After ~25 hours it would OOM with 10GiB of JVM heap configured.

@mafgh mafgh added the bug label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant