Skip to content

test: docker-compose passes server flags via REDIS_ARGS, which the official redis image ignores #658

Description

@nkanu17

Summary

tests/docker-compose.yml passes Redis server flags through the REDIS_ARGS environment variable. REDIS_ARGS is a redis-stack image convention: the redis-stack entrypoint reads it and appends it to the server command line. The official docker.io/library/redis image used by this compose file does not read it at all, so none of these flags are ever applied to the test container.

services:
  redis:
    image: "${REDIS_IMAGE:-redis:8.4}"
    environment:
      # Pin the RediSearch worker pool to 0 (single-threaded, foreground
      # execution). Redis 8.8 changed the default from 0 to a multithreaded
      # background executor, which surfaces a race where FT.SEARCH can return
      # nil fields for docs that expire mid-query -- the source of flaky
      # redis:latest CI runs. WORKERS=0 avoids the race and is already the
      # default on the pinned 8.2/8.4 images, so this is a no-op there.
      - "REDIS_ARGS=--save '' --appendonly no --search-workers ${REDIS_SEARCH_WORKERS:-0}"

The affected settings are --save '', --appendonly no, and --search-workers.

Evidence

Verified locally against redis:latest (Redis 8.10.0):

A container started with the compose file's environment reports the multithreaded default rather than 0:

$ docker run -d -e "REDIS_ARGS=--save '' --appendonly no --search-workers 0" redis:latest
$ docker exec <id> redis-cli CONFIG GET search-workers
search-workers
14

A distinctive setting confirms the variable is ignored entirely rather than partially parsed:

$ docker run -d -e "REDIS_ARGS=--maxmemory 123mb" redis:latest
$ docker exec <id> redis-cli CONFIG GET maxmemory
maxmemory
0

(appendonly no happens to match the image default, so it is not evidence either way.)

Impact

This is test infrastructure only. No shipped redisvl code is affected, so no released version has a defect from this. The consequence is that the test Redis does not have the configuration the compose file says it has, and the --search-workers 0 pin added to reduce flaky CI runs on newer Redis images has never taken effect.

Suggested fix

Pass the flags as real server arguments via a compose command: entry instead of an environment variable:

    command: ["redis-server", "--save", "", "--appendonly", "no", "--search-workers", "${REDIS_SEARCH_WORKERS:-0}"]

Verification worth doing as part of the fix:

  • REDIS_IMAGE=redis:latest docker compose -f tests/docker-compose.yml up -d, then redis-cli CONFIG GET search-workers returns 0.
  • Same check against the pinned redis:8.2 and redis:8.4 images, where 0 is already the default so the change should be a no-op.
  • Confirm --save '' still results in no RDB save points, since quoting an empty argument in compose command form differs from shell quoting.

Note on the flaky CI runs

The compose comment attributes flaky redis:latest runs to a Redis 8.8 multithreaded-search race where FT.SEARCH can return nil fields for docs expiring mid-query. That attribution should be treated as unconfirmed, and this fix should not be assumed to resolve the flakiness.

Attempting to reproduce it: loading 7 documents and querying immediately with no wait, 150 iterations against redis:latest 8.10.0 with search-workers 14, and again with search-workers 0, produced no shortfall in either configuration. Vector queries and filter queries both saw all 7 documents on every iteration.

The redis:latest matrix jobs do fail nondeterministically with a consistent signature of fewer documents than expected, on a rotating cast of tests (test_unf_noindex_integration, test_query_cosine_distance_un_normalized, and test_hybrid.py hybrid queries returning zero rows). Root-causing that is separate work from this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions