Rack::Timeout::RequestTimeoutException Ruby / Rails Origin: Application & API Last updated 5 Nov 2026

Rails: Rack::Timeout::RequestTimeoutException: Request ran for 15001ms, exceeding the 15000ms timeout (Heroku H12)

A request took longer than rack-timeout's limit (or Heroku's 30 s router timeout), so it was aborted.

Exact message you may see Rack::Timeout::RequestTimeoutException: Request ran for 15001ms, exceeding the 15000ms timeoutRequest waited too long in queue Rack::TimeoutHeroku H12 Request timeout
Seen on: Ruby

Meaning

Find slow code: N+1 queries, slow external APIs, big exports. Move heavy work to background jobs (Sidekiq/ActiveJob), add indexes, caches and timeouts on HTTP clients. Tune RACK_TIMEOUT_SERVICE_TIMEOUT only after fixing causes. Heroku H12 means the router gave up after 30 s.

Common causes

  • N+1 queries or missing DB indexes
  • Slow third-party API without timeouts
  • Long exports/reports in a request
  • Cold boot/memory pressure
  • Too few workers/threads causing queueing

⚡ Quick fix

  1. Profile with rack-mini-profiler/APM; fix N+1 (includes)
  2. Use background jobs for long tasks
  3. Set client timeouts (Faraday/Net::HTTP)

Detailed fix by platform

Rails

  1. config.middleware.insert_before Rack::Runtime, Rack::Timeout, service_timeout: 20

How to diagnose

  1. Cause — DB/API/CPU?
  2. Queue — Request queueing?
  3. Fix — Background job?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

2006 — MySQL ERROR 2006 (HY000): MySQL server has gone away (MySQL)20062013 — MySQL ERROR 2013 (HY000): Lost connection to MySQL server during query (MySQL)2013499 Client Closed Request / client prematurely closed connection — Nginx: [info] client prematurely closed connection while reading response header from upstream / access log status 499 (Nginx / Apache)499 Client Closed Req…504 — HTTP 504 Gateway Timeout (HTTP)50457014 — ERROR: canceling statement due to statement timeout (PostgreSQL)57014ActiveRecord::AssociationTypeMismatch — Rails: ActiveRecord::AssociationTypeMismatch: User(#1234) expected, got "42" which is an instance of String(#5678) (Ruby / Rails)ActiveRecord::Associa…ActiveRecord::ConnectionNotEstablished — Rails: ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Base' found (Ruby / Rails)ActiveRecord::Connect…ActiveRecord::Deadlocked: PG::TRDeadlockDetected — Rails: ActiveRecord::Deadlocked: PG::TRDeadlockDetected: ERROR: deadlock detected (Ruby / Rails)ActiveRecord::Deadloc…Rack::Tim…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.