Jira (PUP-10659) Data Type casts case Puppet Server to retain Compiler instances

2 views
Skip to first unread message

Charlie Sharpsteen (Jira)

unread,
Sep 4, 2020, 11:52:03 AM9/4/20
to puppe...@googlegroups.com
Charlie Sharpsteen created an issue
 
Puppet / Bug PUP-10659
Data Type casts case Puppet Server to retain Compiler instances
Issue Type: Bug Bug
Affects Versions: PUP 5.5.21, PUP 6.18.0
Assignee: Unassigned
Components: Functions
Created: 2020/09/04 8:51 AM
Priority: Normal Normal
Reporter: Charlie Sharpsteen

Casting between Puppet Data Types, such as Integer("9"), will cause Puppet Server to retain Puppet::Parser::Catlog objects in memory after requests finish.

See SERVER-2874 for more context and PE reproduction case.

Reproduction Case

  • Install Puppet Server on CentOS 7 along with the Java development tools:

yum install -y http://yum.puppetlabs.com/puppet6-release-el-7.noarch.rpm
yum install -y puppetserver java-devel
source /etc/profile.d/puppet-agent.sh

  • Install the `pupeptlabs-inifile` module and use it to enable JRuby class reification. This allows Ruby objects, like Puppet::Parser::Compiler, to be identified easily in the Java heap:

puppet module install puppetlabs-inifile
 
puppet apply <<'EOF'
ini_subsetting { 'Enable JRuby reify.classes':
  ensure            => present,
  path              => '/etc/sysconfig/puppetserver',
  section           => '',
  key_val_separator => '=',
  setting           => 'JAVA_ARGS',
  subsetting        => '-Djruby.reify.classes',
  value             => '=true',
}
EOF

  • Bootstrap the CA, configure the agent, and start the puppetserver service:

puppetserver ca setup
puppet config set server $(hostname -f)
systemctl start puppetserver

  • Give the service a trivial catalog to compile:

cat <<'EOF' > /etc/puppetlabs/code/environments/production/manifests/site.pp
node default {
  $string_version = "9"
  $version = Integer($string_version)
}
EOF

  • Run puppet a couple of times:

puppet agent -t
puppet agent -t

  • Check the number of Puppet::Parser::Compiler instances retained in Puppet Server memory:

sudo -u puppet jmap -histo:live $(systemctl show -p MainPID puppetserver|cut -d= -f2)|fgrep 'rubyobj.Puppet.Parser.Compiler'

Outcome

After running the agent twice, the puppetserver service is retaining two Compiler instances in memory:

# sudo -u puppet jmap -histo:live $(systemctl show -p MainPID puppetserver|cut -d= -f2)|fgrep 'rubyobj.Puppet.Parser.Compiler'
5871:             2             64  rubyobj.Puppet.Parser.Compiler

Expected Outcome

No compiler instances should be retained as the compiler is discarded at the end of the request and the -histo:live flag forces a full garbage collection.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages