From 23b614d42bfbd20060c76bc9c88af7ceebcb0f43 Mon Sep 17 00:00:00 2001 From: Colin Surprenant Date: Wed, 10 Dec 2014 11:43:33 -0800 Subject: [PATCH] correclty reset bundler, disabled multiple jobs, removed .done file stuff Fixes #2203 --- lib/logstash/environment.rb | 4 ++-- rakelib/plugin.rake | 18 ++++++++++++++++-- rakelib/vendor.rake | 33 ++++++++++++++++----------------- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/lib/logstash/environment.rb b/lib/logstash/environment.rb index 0f7cde815..61c3c9fba 100644 --- a/lib/logstash/environment.rb +++ b/lib/logstash/environment.rb @@ -48,12 +48,12 @@ module LogStash end def bundler_install_command(gem_file, gem_path) + # for now avoid multiple jobs, ex.: --jobs 4 + # it produces erratic exceptions and hangs (with Bundler 1.7.9) [ "install", "--gemfile=#{gem_file}", - "--clean", "--without", "development", - "--jobs", "4", "--path", gem_path, ] end diff --git a/rakelib/plugin.rake b/rakelib/plugin.rake index 438a711ba..1c6623756 100644 --- a/rakelib/plugin.rake +++ b/rakelib/plugin.rake @@ -13,8 +13,22 @@ namespace "plugin" do end # task "install" task "install-defaults" => [ "dependency:bundler" ] do - ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home - Bundler::CLI.start(LogStash::Environment.bundler_install_command("tools/Gemfile.plugins", LogStash::Environment::BUNDLE_DIR)) + 10.times do + begin + ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home + ENV["BUNDLE_PATH"] = LogStash::Environment.logstash_gem_home + ENV["BUNDLE_GEMFILE"] = "tools/Gemfile.plugins" + # Bundler::Retry.attempts = 0 + Bundler.definition(true) + Bundler::CLI.start(LogStash::Environment.bundler_install_command("tools/Gemfile.plugins", LogStash::Environment::BUNDLE_DIR)) + break + rescue => e + # for now catch all, looks like bundler now throws Bundler::InstallError, Errno::EBADF + puts(e.message) + puts("--> Retrying install-defaults upon exception=#{e.class}") + sleep(1) + end + end # because --path creates a .bundle/config file and changes bundler path # we need to remove this file so it doesn't influence following bundler calls diff --git a/rakelib/vendor.rake b/rakelib/vendor.rake index 29c21e677..e8652a21e 100644 --- a/rakelib/vendor.rake +++ b/rakelib/vendor.rake @@ -12,8 +12,6 @@ DOWNLOADS = { "kafka" => { "version" => "0.8.1.1", "sha1" => "d73cc87fcb01c62fdad8171b7bb9468ac1156e75", "scala_version" => "2.9.2" }, } -DONEFILE = File.join(LogStash::Environment::LOGSTASH_HOME, ".install-done") - def vendor(*args) return File.join("vendor", *args) end @@ -204,11 +202,7 @@ namespace "vendor" do #task "all" => "collectd" namespace "force" do - task "delete_donefile" do - File.delete(DONEFILE) if File.exist?(DONEFILE) - end - - task "gems" => ["delete_donefile", "vendor:gems"] + task "gems" => ["vendor:gems"] end task "gems" => [ "dependency:bundler" ] do @@ -217,21 +211,26 @@ namespace "vendor" do Rake::Task["dependency:rbx-stdlib"] if LogStash::Environment.ruby_engine == "rbx" Rake::Task["dependency:stud"].invoke - # Skip bundler if we've already done this recently. - if File.file?(DONEFILE) - age = (Time.now - File.lstat(DONEFILE).mtime) - # Skip if the donefile was last modified recently - next if age < 300 + 10.times do + begin + ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home + ENV["BUNDLE_PATH"] = LogStash::Environment.logstash_gem_home + ENV["BUNDLE_GEMFILE"] = "tools/Gemfile" + # Bundler::Retry.attempts = 0 + Bundler.definition(true) + Bundler::CLI.start(LogStash::Environment.bundler_install_command("tools/Gemfile", LogStash::Environment::BUNDLE_DIR)) + break + rescue => e + # for now catch all, looks like bundler now throws Bundler::InstallError, Errno::EBADF + puts(e.message) + puts("--> Retrying vendor:gems upon exception=#{e.class}") + sleep(1) + end end - ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home - Bundler::CLI.start(LogStash::Environment.bundler_install_command("tools/Gemfile", LogStash::Environment::BUNDLE_DIR)) - # because --path creates a .bundle/config file and changes bundler path # we need to remove this file so it doesn't influence following bundler calls FileUtils.rm_rf(::File.join(LogStash::Environment::LOGSTASH_HOME, "tools/.bundle")) - - File.write(DONEFILE, Time.now.to_s) end # task gems task "all" => "gems"