Heroku上的独角兽投掷奇怪的错误导致H13服务器错误。是什么杀了我的独角兽?

时间:2014-09-15 22:55:34

标签: ruby-on-rails ruby heroku unicorn

我在Heroku上运行了一个Rails 4应用程序突然开始抛出很多H13错误。我已经通过日志跟踪了它,并看到很多错误,独角兽抱怨memoized object is not a string。然后由SIGIOT收集这些过程。这是确切的错误:

unicorn_http.rl:295: write_value: Assertion `rb_type((VALUE)(f)) == RUBY_T_STRING && "memoized object is not a string"' failed.

错误也可能如下所示:

unicorn_http.rl:296: write_value: Assertion `(!!((!(((VALUE)(f) & RUBY_IMMEDIATE_MASK) || !!(((VALUE)(f) & ~((VALUE)RUBY_Qnil)) == 0)) && (int)(((struct RBasic*)(f))->flags & RUBY_T_MASK) != RUBY_T_NODE)?(((struct RBasic*)(f))->flags&((((VALUE)1)<<11))):((((int)(long)(f))&RUBY_FIXNUM_FLAG)||((((int)(long)(f))&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG)))) && "unfrozen object"' failed. 

它发生在许多不同的路线上,我似乎无法弄清楚它发生了什么。我运行一个非常股票的独角兽配置:

worker_processes Integer(ENV["WEB_CONCURRENCY"] || 2)
timeout 29
preload_app true

before_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
    Process.kill 'QUIT', Process.pid
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection
end

这是Heroku日志的片段,错误:

Sep 15 15:38:42 #{app} heroku/router:  at=error code=H13 desc="Connection closed without response" method=GET path="#{path}" host=host.org request_id=6af16b9e-02ff-494e-8c8c-11f060f3b8fe fwd="109.63.24.000" dyno=web.1 connect=1ms service=15ms status=503 bytes=1187 
Sep 15 15:38:42 #{app} app/web.1:  unicorn worker[1] -p 4635 -c ./config/unicorn.rb: unicorn_http.rl:295: write_value: Assertion `rb_type((VALUE)(f)) == RUBY_T_STRING && "memoized object is not a string"' failed. 
Sep 15 15:38:42 #{app} app/web.1:  I, [2014-09-15T22:38:41.878914 #675]  INFO -- : worker=1 ready 
Sep 15 15:38:42 #{app} app/web.1:  E, [2014-09-15T22:38:41.835934 #2] ERROR -- : reaped #<Process::Status: pid 672 SIGIOT (signal 6)> worker=1 

...

Sep 15 15:26:52 #{app} app/web.1:  unicorn worker[0] -p 4635 -c ./config/unicorn.rb: unicorn_http.rl:295: write_value: Assertion `rb_type((VALUE)(f)) == RUBY_T_STRING && "memoized object is not a string"' failed. 
Sep 15 15:26:52 #{app} app/web.1:  E, [2014-09-15T22:26:52.483577 #2] ERROR -- : reaped #<Process::Status: pid 487 SIGIOT (signal 6)> worker=0 
Sep 15 15:26:52 #{app} heroku/router:  at=error code=H13 desc="Connection closed without response" method=GET path="#{path}" host=host.org request_id=92fbf67f-56b1-4144-917a-c3d29171f631 fwd="76.234.45.000" dyno=web.1 connect=4ms service=18ms status=503 bytes=1208 

请求排队通常<10毫秒在这个应用程序上,这似乎刚刚开始,但我没有改变多年来的独角兽设置。该应用程序是一个运行Rails 4.1.1的Heroku应用程序,在Unicorn 4.8.2上运行Ruby 2.0.0。它使用memecache与dalli进行一些最小的缓存。请求因H13错误而立即失败,因此我没有达到unicorn.rb配置中设置的29秒超时。

0 个答案:

没有答案