Skip to content
Latchkey

Redis "LOADING Redis is loading the dataset in memory" in CI

On startup Redis loads its dataset from RDB or AOF and rejects most commands with "LOADING Redis is loading the dataset in memory" until that completes. In CI this appears when a persisted dump is restored before the service is ready.

What this error means

Early commands fail with "LOADING Redis is loading the dataset in memory" and succeed once loading finishes, making the first test flaky.

redis-cli
(error) LOADING Redis is loading the dataset in memory
# python:
redis.exceptions.BusyLoadingError: Redis is loading the dataset in memory

Common causes

A persisted dataset is being loaded at boot

A mounted dump.rdb or appendonly file makes Redis spend time loading before it answers, and PING may pass while data commands still return LOADING.

Connecting during the load window

The health check passed but the dataset load is not complete, so the first real command hits the LOADING state.

How to fix it

Start with no dataset to load

For ephemeral CI, disable persistence so there is nothing to load at startup.

.github/workflows/ci.yml
services:
  redis:
    image: redis:7
    options: --save "" --appendonly no
    ports: ['6379:6379']

Wait until loading finishes

Poll a data command (not just PING) and retry on the LOADING error before running tests.

Terminal
until redis-cli -h localhost -p 6379 get __probe__ >/dev/null 2>&1; do
  echo "redis still loading dataset..."; sleep 1
done

How to prevent it

  • Avoid mounting a large RDB/AOF into the CI Redis unless tests need it.
  • Gate tests on a data command, not only on PING.
  • Keep persistence off for throwaway test data.

Frequently asked questions

What causes ""LOADING Redis is loading the dataset in memory""?
A mounted dump.rdb or appendonly file makes Redis spend time loading before it answers, and PING may pass while data commands still return LOADING.
How do I fix "LOADING Redis is loading the dataset in memory"?
For ephemeral CI, disable persistence so there is nothing to load at startup.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card