Skip to content
Latchkey

Rack::Timeout::RequestTimeoutError in CI

Rack::Timeout aborted a request that ran longer than its configured limit. In CI this usually means a request blocked on a slow or unavailable external dependency rather than the app logic being wrong.

What this error means

A request or system spec fails with Rack::Timeout::RequestTimeoutError after the timeout window. It can be intermittent, tied to a dependency (DB, HTTP API, queue) being slow on the runner.

rails
Rack::Timeout::RequestTimeoutError:
       Request ran for longer than 15000ms
     # rack-timeout aborted the request

Common causes

Blocked on a slow dependency

The request waited on a database, cache, or external HTTP call that was slow or unreachable on the runner, exceeding the timeout.

Real external calls in tests

A test hit a live external service (not stubbed) that hung, tripping Rack::Timeout.

Timeout too low for CI

The configured Rack::Timeout is tuned for production and is too aggressive for slower CI hardware.

How to fix it

Remove the slow dependency from the path

  1. Stub external HTTP calls in tests (WebMock/VCR) so requests do not block on the network.
  2. Ensure the database/cache services are ready before tests run.
  3. Relax or disable Rack::Timeout in the test environment if it is not under test.

Tune the timeout for the test env

Ruby
# config/initializers/rack_timeout.rb
Rack::Timeout.service_timeout = ENV.fetch('RACK_TIMEOUT', 15).to_i
# or disable in test where it is not the subject under test

How to prevent it

  • Stub all external network calls in tests.
  • Gate tests on dependency readiness.
  • On self-healing managed runners (Latchkey), timeouts caused by transient slowness in an external service are auto-retried rather than failing the run outright.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →