Skip to content

support redis v8 #6764

Closed
Closed

Description

@pbsds

Please support https://pypi.org/project/redis/ v8. This version is currently excluded:

"redis >=6.4,<8.0",

Activity

  1. added
    feature request
    on Jul 14, 2026
  2. linear-code commented on Jul 14, 2026

    @linear-code
  3. masenf commented on Sep 1, 2026

    @masenf
    Collaborator

    I attempted this in #7019 (widening redis >=6.4,<8.0 → <9.0) and backed it out, because redis-py 8 hangs on Python 3.10 and 3.11. Recording the diagnosis here so the next attempt starts from evidence rather than repeating it.

    The blocker

    With REFLEX_REDIS_URL set, three redis-backed tests hang indefinitely on Python ≤ 3.11 under redis-py 8.1.0:

    Test Where it hangs
    tests/units/test_app.py::test_initialize_with_state in the test body, awaiting app.state_manager.get_state(...) — parked in the event-loop selector with timeout = -1
    tests/units/istate/manager/test_redis.py::test_modify_oplock async-fixture finalizer teardown
    tests/units/test_state.py::test_on_load_internal_supersedes_previous_navigation event-loop/runner teardown

    The first one matters most: it is not a teardown artifact. It hangs on get_state, which is a normal runtime path, so this is not "just the tests".

    In CI this presents as the unit-tests workflow being cancelled, not failed — Run unit tests w/ redis sits for ~26 minutes on ubuntu 3.10/3.11 until the 30-minute job timeout kills it, while 3.12/3.13/3.14 finish the same step in 1–2 minutes. Because the conclusion is cancelled, it reads as "nothing failed" on the checks API and in the check-suite webhook.

    A/B that isolates it

    Same interpreter, same machine, same command, nothing else running, against a flushed redis:

    py3.11 + redis-py 7.4.1 →  0 hangs, 120s
    py3.11 + redis-py 8.1.0 →  3 hangs (60s pytest-timeout each), 300s
    

    So it is redis-py 8, not a pre-existing 3.11 problem, and not the sandbox. (The 15 unrelated failures present in both runs are local environment noise — pyi-golden tests needing a working ruff, and two IPv6-dependent test_processes tests.)

    How to reproduce

    uv sync -p 3.11                      # a 3.11 environment
    uv pip install pytest-timeout
    redis-server --daemonize yes --port 6379 --save ''
    export REFLEX_REDIS_URL=redis://localhost:6379
    uv run pytest tests/units -p no:randomly --timeout=60 --timeout-method=signal -q

    Use --timeout-method=signal, not thread. The hanging tests are async, so with thread the stack dump shows only pytest's own frames and never names the test; signal raises inside the test and reports it by name.

    Notes for whoever picks this up

    • The three hangs are context-dependent: tests/units/test_app.py passes in isolation (147 tests, 1.85s) with redis-py 8. They only hang in a full-suite run, which suggests accumulated client/connection state matters.
    • Worth checking against the redis-py 8.0 defaults changes: max_connections 100, socket_timeout/socket_connect_timeout 5s, and retries moving from 3 to 10 attempts with exponential jitter backoff.
    • redis-py 8 hangs on Python 3.10/3.11 — blocks the redis v8 upgrade (#6764) #7026 is a related but distinct finding from the same investigation: an orphaned StateManagerRedis._lock_task resists cancellation at loop teardown under redis-py 8 on ≤3.11 (cancelling=1 while awaiting a freshly created future). Refresh outdated dependencies flagged on the release branch #7019 fixed the test fixture that orphaned it, but the underlying cancellation behavior is unexplained and may share a root cause with the hangs above.
    • The redis-8 response-type narrowing (bytes | str → bytes | None at the call sites in istate/manager/redis.py and utils/token_manager.py) is already merged in Refresh outdated dependencies flagged on the release branch #7019 and verified clean under pyright with both 7.4.1 and 8.1.0, so that groundwork does not need redoing.
    • redis is filtered out of the backend outdated-dependency check in Refresh outdated dependencies flagged on the release branch #7019 with a pointer here, so it will stop showing up as a perpetually-stale row until this is resolved. Remove it from that filter when the bound widens.

    Generated by Claude Code

  4. masenf commented on Sep 1, 2026

    @masenf
    Collaborator

    Tracking correction: the blocker described in my comment above now has its own issue — #7026 — so it is visible from the issue list rather than buried in a comment here.

    This issue stays open as the request; #7026 carries the diagnosis, the A/B isolating it to redis-py 8, the reproduction recipe, and the checklist. Closing #7026 should unblock closing this one.

    One amendment to my earlier comment: it said the fixture-leak fix in #7019 addressed the orphaned _lock_task, framed as if that were the hang. It removed one orphaned task, but three separate hangs remained — including test_app.py::test_initialize_with_state, which hangs on get_state rather than in teardown. #7026 has the corrected picture.


    Generated by Claude Code

  5. Marvelous2095 commented on Oct 25, 2026

    @Marvelous2095

    Independent confirmation from a downstream user for the Python 3.12+ side of the matrix in #7026:

    • Reflex 0.10.0 (lock-resolved with redis 7.4.1), then redis==8.1.0 force-installed over it (pip reports the expected redis<8.0 conflict), Python 3.13, Redis server 8.10.2.
    • The app's own unit tests (141) pass identically with redis-py 7.4.1 and 8.1.0.
    • StateManagerRedis against the real server behaves identically with both client versions: modify_state/get_state round trip, 8 concurrent modify_state calls on the same token (locks, Lua scripts, pub/sub, keyspace notifications) end at the expected value, keyspace notifications get enabled via config_set.
    • Not covered: the token manager, long-running load, Python 3.11 (the hang described in redis-py 8 hangs on Python 3.10/3.11 — blocks the redis v8 upgrade (#6764) #7026).

    So at least for Python >= 3.12 the redis<8.0 bound looks purely precautionary. If it helps users on 3.12+ in the meantime, a split like redis>=6.4,<9.0; python_version >= "3.12" and redis>=6.4,<8.0; python_version < "3.12" would let them resolve redis-py 8 without waiting for the 3.11 fix. Happy to run further checks on 3.13 if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions