vendor/bundle/ruby/2.1.0/gems/unicorn-worker-killer-0.4.2/lib/unicorn/worker_killer.rb
def process_client(client)
      super(client) # Unicorn::HttpServer#process_client
      return if @_worker_memory_limit_min == 0 && @_worker_memory_limit_max == 0

      @_worker_process_start ||= Time.now
      @_worker_memory_limit ||= @_worker_memory_limit_min + randomize(@_worker_memory_limit_max - @_worker_memory_limit_min + 1)
      @_worker_check_count += 1

      if @_worker_check_count % @_worker_check_cycle == 0
        rss = _worker_rss()
        logger.info "#{self}: worker (pid: #{Process.pid}) using #{rss} bytes." if @_verbose
        if rss > @_worker_memory_limit
          logger.warn "#{self}: worker (pid: #{Process.pid}) exceeds memory limit (#{rss} bytes > #{@_worker_memory_limit} bytes)"
          Unicorn::WorkerKiller.kill_self(logger, @_worker_process_start)
        end
        @_worker_check_count = 0
      end
    end
# Killing the process must be occurred at the outside of the request. We're
# using similar techniques used by OobGC, to ensure actual killing doesn't
# affect the request.
#
# @see https://github.com/defunkt/unicorn/blob/master/lib/unicorn/oob_gc.rb#L40
Killing the process must be occurred at the outside of the request. We're
using similar techniques used by OobGC, to ensure actual killing doesn't
affect the request.
Killing the process must be occurred at the outside of the request . We ' re using similar techniques used by OobGC to ensure actual killing doesn ' t affect the request .
def process_client(client)
      super(client) 
      return if @_worker_memory_limit_min == 0 && @_worker_memory_limit_max == 0
      @_worker_process_start ||= Time.now
      @_worker_memory_limit ||= @_worker_memory_limit_min + randomize(@_worker_memory_limit_max - @_worker_memory_limit_min + 1)
      @_worker_check_count += 1
      if @_worker_check_count % @_worker_check_cycle == 0
        rss = _worker_rss()
        logger.info "#{self}: worker (pid: #{Process.pid}) using #{rss} bytes." if @_verbose
        if rss > @_worker_memory_limit
          logger.warn "#{self}: worker (pid: #{Process.pid}) exceeds memory limit (#{rss} bytes > #{@_worker_memory_limit} bytes)"
          Unicorn::WorkerKiller.kill_self(logger, @_worker_process_start)
        end
        @_worker_check_count = 0
      end
    end
def process_client ( client ) super ( client ) return if @_worker_memory_limit_min == 0 && @_worker_memory_limit_max == 0 @_worker_process_start ||= Time . now @_worker_memory_limit ||= @_worker_memory_limit_min + randomize ( @_worker_memory_limit_max - @_worker_memory_limit_min + 1 ) @_worker_check_count += 1 if @_worker_check_count % @_worker_check_cycle == 0 rss = _worker_rss ( ) logger . info "#{self}: worker (pid: #{Process.pid}) using #{rss} bytes." if @_verbose if rss > @_worker_memory_limit logger . warn "#{self}: worker (pid: #{Process.pid}) exceeds memory limit (#{rss} bytes > #{@_worker_memory_limit} bytes)" Unicorn :: WorkerKiller . kill_self ( logger , @_worker_process_start ) end @_worker_check_count = 0 end end
Killing the process must be occurred at the outside of the request.
Killing the process must be occurred at the outside of the request .
# Unicorn::HttpServer#process_client
client
see
None