Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-11501

extreme long puppet run in case of selinux and lots of mounts

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Duplicate
    • PUP 5.5.21
    • None
    • None
    • Needs Assessment
    • Needs Assessment

    Description

      It seems that for almost every file that puppet encounters, it checks for selinux attributes, and by doing so it will scan the complete /proc/mounts in chunks of 1024 bytes to try to determine the filesystem type. 

       

      So on any server that has selinux activated and more than 1000 mounts, puppet will use huge amounts of CPU and take ages…

       

      I've created a a small patch that caches results. On some servers puppet run went from 2 hours to 10 minutes!

       

      $ diff /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/selinux.rb selinux_patched.rb
      16c16,18
      < def self.selinux_support?

      > $mounts = {}
      >
      > def selinux_support?
      24,27d25
      < def selinux_support?
      < Puppet::Util::SELinux.selinux_support?
      < end
      <
      209,211c207
      < loop do
      < mounts += mountfh.read_nonblock(1024)
      < end

      > mounts += mountfh.read_nonblock(1024) while true
      241c237,244
      < return nil unless mounts = read_mounts

      >
      > if $mounts.empty?
      > # fill $mounts hash if still empty.
      > # Most probably only executed the first time this function is called.
      > $mounts = {} unless $mounts = read_mounts
      > end
      >
      > return nil if mounts.empty?
      254c257
      < return mounts[segment.to_s] if mounts.has_key?(segment.to_s)

      > return $mounts[segment.to_s] if $mounts.has_key?(segment.to_s)

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              frankygt Frank van Gestel
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support