title: Unicorn Refreshing Gem List
body: <p>Guys I'm trying to restart my unicorn service and seems it get stuck on this</p>
  <blockquote>
  <p>[2019-03-06T20:45:05.938802 #7614]  INFO -- : Refreshing Gem list</p>
  <p>/usr/local/rvm/gems/ruby-2.5.1@citius_artis/gems/unicorn-5.5.0/lib/unicorn.rb:49:in</p>
  <p>`block in builder': wrong number of arguments (given 0, expected 2)
  (ArgumentError)</p>
  </blockquote>
  <p>Did not change anything on gemfile</p>
  <p>If I run rails s -e staging the rails starts normally</p>
  <p>Any ideas?</p>
  <p>My unicorn.rb config</p>
  <pre><code>APP_ROOT = File.expand_path(File.dirname(File.dirname(__FILE__)))
  
  # puts &quot;APP ROOT -&gt;&gt;&gt; #{APP_ROOT}&quot;
  
  if ENV['MY_RUBY_HOME'] &amp;&amp; ENV['MY_RUBY_HOME'].include?('rvm')
    begin
      rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME']))
      # puts &quot;RUBY HOME -&gt;&gt;&gt; #{rvm_path}&quot;
      rvm_lib_path = File.join(rvm_path, 'lib')
      # $LOAD_PATH.unshift rvm_lib_path
      # require 'rvm'
      # RVM.use_from_path! APP_ROOT
    rescue LoadError
      raise &quot;RVM ruby lib is currently unavailable.&quot;
    end
  end
  
  ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
  require 'bundler/setup'
  
  if ENV['RAILS_ENV'] == 'production'
    worker_processes 2
  else
    worker_processes 2
  end
  
  working_directory APP_ROOT
  
  preload_app true
  
  timeout 60
  
  listen APP_ROOT + &quot;/tmp/sockets/unicorn.sock&quot;, :backlog =&gt; 64
  
  pid APP_ROOT + &quot;/tmp/pids/unicorn.pid&quot;
  
  stderr_path APP_ROOT + &quot;/log/unicorn.stderr.log&quot;
  stdout_path APP_ROOT + &quot;/log/unicorn.stdout.log&quot;
  
  before_fork do |server, worker|
    # puts &quot;SERVER -&gt;&gt;&gt; #{server}&quot;
  
    defined?(ActiveRecord::Base) &amp;&amp; ActiveRecord::Base.connection.disconnect!
  
    old_pid = APP_ROOT + '/tmp/pids/unicorn.pid.oldbin'
    if File.exists?(old_pid) &amp;&amp; server.pid != old_pid
      begin
        Process.kill(&quot;QUIT&quot;, File.read(old_pid).to_i)
      rescue Errno::ENOENT, Errno::ESRCH
        # puts &quot;Old master alerady dead&quot;
      end
    end
  end
  
  after_fork do |server, worker|
    if defined?(ActiveRecord::Base)
      config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env]
      config['pool'] = ENV[&quot;DB_POOL&quot;] || ENV['RAILS_MAX_THREADS'] || 5
  
      ActiveRecord::Base.establish_connection(config)
    end
  end
  </code></pre>