Constrain txredisapi version to avoid incompatible breaking changes in txredisapi@1.6.0 (#20354)

Fix https://github.com/element-hq/synapse/issues/20347

See
https://github.com/element-hq/synapse/issues/20347#issuecomment-6154861014
for more details.

Caused by the latest release of `txredisapi@1.6.0` (2026-10-09) which included https://github.com/IlyaSkriblovsky/txredisapi/pull/162

> May break compatibility with some specific user code because of inheritance changes.

And in the changelog:

> ### Incompatible changes
> 
> - Connections are maintained by
>   `twisted.application.internet.ClientService` now, and `RedisFactory` is no
>   longer a `ReconnectingClientFactory`. Code connecting a factory on its own
>   with `reactor.connectTCP()` or `twisted.application.internet.TCPClient` has
>   to use `factory.startConnecting(endpoint)` instead - see `examples/subscriber.py`
> 
> - `factory.continueTrying = False` is replaced by `factory.stopTrying()`;
>   `retry()`, `resetDelay()` and `delay` are gone. `maxDelay`, `initialDelay`,
>   `factor` and `jitter` still configure the backoff and are used by the new
>   `RedisFactory.retryDelay()`
> 
> - `SentinelConnectionFactory.try_to_connect()` is gone: the address of the
>   master or of a slave is discovered by the endpoint before every attempt.
>   Subclasses overriding `try_to_connect()`, `clientConnectionFailed()` or
>   `clientConnectionLost()` have no effect anymore
>
> [...]
>
> *-- [`IlyaSkriblovsky/txredisapi` -> *Release 1.6.0 (2026-10-09)*](https://github.com/IlyaSkriblovsky/txredisapi/blob/f844759b8aabc689eb87bf300ed3c675b84c3608/CHANGELOG.md#L31-L35)*




### Testing strategy

1. Check out the PR: `git checkout
madlittlemods/20347-txredisapi-constraint`
 1. Install into a fresh scratch venv:
     ```shell
    rm -rf /tmp/venv && python3 -m venv /tmp/venv
    /tmp/venv/bin/pip install '.[all]'
/tmp/venv/bin/pip show txredisapi | grep Version # expect 1.5.0 with
this PR
    ```
 1. One-time setup: make a homeserver config with Redis enabled:
    ```shell
    mkdir -p /tmp/hs && cd /tmp/hs
/tmp/venv/bin/python -m synapse.app.homeserver --server-name repro.test
\
        -c homeserver.yaml --generate-config --report-stats=no
printf '\nredis:\n enabled: true\n host: localhost\n' >> homeserver.yaml
    cd -
    ```
- On my machine, I also have to remove the IPv6 bind for `::1`, so `sed
-i '/^ - ::1$/d' /tmp/hs/homeserver.yaml`
1. Run Synapse: `/tmp/venv/bin/python -P -m synapse.app.homeserver -c
/tmp/hs/homeserver.yaml`
- It should run successfully with this PR. You can also check
`/tmp/hs/homeserver.log` for logs.

Repeat these steps on `develop` to see the original failure described in
https://github.com/element-hq/synapse/issues/20347 (`AttributeError:
'super' object has no attribute 'startedConnecting'. Did you mean:
'startConnecting'?`)
This commit is contained in:
Eric Eastwood authored and GitHub committed 2026-10-14 08:47:40 -05:00
1 parent be4d86c669
commit 2c52f9820e
3 files changed
+16 -8

No files matched your search

+1
View File
@@ -0,0 +1 @@
Fix Synapse failing to start with Redis enabled when installed using pip (avoid incompatible breaking changes in `txredisapi@1.6.0`).
Generated
+2 -2
View File
@@ -1972,7 +1972,7 @@ files = [
{file = "pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992"},
{file = "pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29"},
]
markers = {main = "implementation_name != \"PyPy\"", dev = "platform_python_implementation != \"PyPy\" and implementation_name != \"PyPy\""}
markers = {main = "implementation_name != \"PyPy\"", dev = "implementation_name != \"PyPy\" and platform_python_implementation != \"PyPy\""}
[[package]]
name = "pydantic"
@@ -3661,4 +3661,4 @@ url-preview = ["beautifulsoup4"]
[metadata]
lock-version = "2.1"
python-versions = ">=3.10.0,<4.0.0"
content-hash = "b8ee2c063150549de2946f70cd557c427e16a9101052915ef23eb6dd9d8f77eb"
content-hash = "6e8f0d223b61ab7c100236797f0ec1eed7f23b819c01c117fe445c6b1e91bbfc"
+13 -6
View File
@@ -152,11 +152,18 @@ opentracing = [
"tornado>=6.0", # via jaeger-client
]
jwt = ["authlib"]
# hiredis is not a *strict* dependency, but it makes things much faster.
# (if it is not installed, we fall back to slow code.)
# txredisapi 1.4.12 is the first release to accept a `username` kwarg for
# Redis ACL auth: https://github.com/IlyaSkriblovsky/txredisapi/releases/tag/1.4.12
redis = ["txredisapi>=1.4.12", "hiredis>=0.3"]
redis = [
# txredisapi 1.4.12 is the first release to accept a `username` kwarg for
# Redis ACL auth: https://github.com/IlyaSkriblovsky/txredisapi/releases/tag/1.4.12
#
# FIXME: 1.6.0 introduces a number of incompatible breaking changes that will
# require updates to our own code, see
# https://github.com/element-hq/synapse/issues/20347#issuecomment-6154861014
"txredisapi>=1.4.12,<1.6.0",
# hiredis is not a *strict* dependency, but it makes things much faster.
# (if it is not installed, we fall back to slow code.)
"hiredis>=0.3"
]
# Required to use experimental `caches.track_memory_usage` config option.
cache-memory = ["pympler>=1.0"]
# If this is updated, don't forget to update the equivalent lines in
@@ -190,7 +197,7 @@ all = [
# opentracing
"jaeger-client>=4.2.0", "opentracing>=2.2.0",
# redis
"txredisapi>=1.4.12", "hiredis>=0.3",
"txredisapi>=1.4.12,<1.6.0", "hiredis>=0.3",
# cache-memory
# 1.0 added support for python 3.10, our current minimum supported python version
"pympler>=1.0",