Why are we hitting Heroku's H12 "Request timeout" if we have Rack::Timeout set to 10s

Viewed 273

I've gotten some 503s in Heroku even though in config/initializers/timeout.rb I have this:

Rack::Timeout.service_timeout = 10 # seconds
Rack::Timeout.wait_timeout = 5

Shouldn't this get triggered before Heroku itself can timeout?

This is config/puma.rb

workers Integer(ENV["WEB_CONCURRENCY"] || 2)
threads_count = Integer(ENV["MAX_THREADS"] || 5)
threads threads_count, threads_count

worker_timeout 15
worker_shutdown_timeout 8

preload_app!

rackup DefaultRackup
port ENV["PORT"] || 3000
environment ENV["RACK_ENV"] || "development"

on_worker_boot do
    ActiveRecord::Base.establish_connection
end

Gemfile

gem "puma", "~> 3.10"
gem "rack-timeout", "~> 0.4"

Btw, here is an example from the logs

Error at=error code=H12 desc="Request timeout" method=GET path="/serviceworker.js" host=dev.to request_id={ommitted} fwd="{ommitted}" dyno=web.6 connect=0ms service=30000ms status=503 bytes=0 protocol=http
0 Answers
Related