Skip to content
Snippets Groups Projects

Fix memory leak in CI config includes entry

Merged Stan Hu requested to merge gb-fix-slow-ci-config-15-10 into 15-10-stable-ee
1 unresolved thread
2 files
+ 19
11
Compare changes
  • Side-by-side
  • Inline
Files
2
  • In GitLab 11.9,
    gitlab-foss!24098
    introduced validation of `include` keywords. However, it quietly
    introduced a memory leak: any time a new `include` entry was
    instantiated, a proc would be added to the `aspects` class variable.
    As the list grew, the time taken to process other `include` keywords
    would grow.
    
    This commit fixes this by doing away with the class variable in favor of
    `ComposableArray`.
    
    Changelog: fixed
@@ -7,7 +7,7 @@ module Entry
##
# Entry that represents a list of include.
#
class Includes < ::Gitlab::Config::Entry::Node
class Includes < ::Gitlab::Config::Entry::ComposableArray
include ::Gitlab::Config::Entry::Validatable
validations do
@@ -23,16 +23,8 @@ class Includes < ::Gitlab::Config::Entry::Node
end
end
def self.aspects
super.append -> do
@config = Array.wrap(@config)
@config.each_with_index do |config, i|
@entries[i] = ::Gitlab::Config::Entry::Factory.new(Entry::Include)
.value(config || {})
.create!
end
end
def composable_class
Entry::Include
end
end
end
Loading