Skip to content

Connection lost issue since 4.4.0 upgrade #2491

Closed
@sileht

Description

@sileht

Version: What redis-py and what redis version is the issue happening on?

redis-py: 4.4.0
redis: 6.2.3

Platform: What platform / version? (For example Python 3.5.1 on Windows 7 / Ubuntu 15.10 / Azure)

Docker image of python: 3.11.0 on Debian bullseye

Description: Description of your issue, stack traces from errors and code that reproduces the issue

We upgrade an application to redis-py 4.4.0 and got the following traceback a lot. Downgrading to 4.3.5 solves the issue for us.

If you need more information, feel free to ask.

ConnectionResetError: Connection lost
  File "redis/asyncio/connection.py", line 752, in send_packed_command
    await self._writer.drain()
  File "asyncio/streams.py", line 378, in drain
    await self._protocol._drain_helper()
  File "asyncio/streams.py", line 167, in _drain_helper
    raise ConnectionResetError('Connection lost')
ConnectionError: Error UNKNOWN while writing to socket. Connection lost.
  File "starlette/applications.py", line 124, in __call__
    await self.middleware_stack(scope, receive, send)
  File "starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "xxxxxxx/middlewares/starlette_workaround.py", line 29, in __call__
    await super().__call__(scope, receive, send)
  File "starlette/middleware/base.py", line 106, in __call__
    response = await self.dispatch_func(request, call_next)
  File "xxxxxxx/middlewares/starlette_workaround.py", line 20, in dispatch
    return await call_next(request)
  File "starlette/middleware/base.py", line 80, in call_next
    raise app_exc
  File "starlette/middleware/base.py", line 69, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "starlette/middleware/httpsredirect.py", line 19, in __call__
    await self.app(scope, receive, send)
  File "starlette/middleware/base.py", line 106, in __call__
    response = await self.dispatch_func(request, call_next)
  File "xxxxxxx/middlewares/security.py", line 15, in dispatch
    response = await call_next(request)
  File "starlette/middleware/base.py", line 80, in call_next
    raise app_exc
  File "starlette/middleware/base.py", line 69, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "ratelimit/core.py", line 90, in __call__
    return await self.app(scope, receive, send)
  File "starsessions/middleware.py", line 138, in __call__
    await self.app(scope, receive, send_wrapper)
  File "starsessions/middleware.py", line 157, in __call__
    await load_session(connection)
  File "starsessions/session.py", line 49, in load_session
    await get_session_handler(connection).load()
  File "starsessions/session.py", line 110, in load
    await self.store.read(
  File "xxxxxxx/asgi_session.py", line 28, in read
    value, invalid = typing.cast(tuple[bytes | None, bool], await pipe.execute())
  File "ddtrace/contrib/redis/asyncio_patch.py", line 29, in traced_async_execute_pipeline
    return await func(*args, **kwargs)
  File "redis/asyncio/client.py", line 1377, in execute
    return await conn.retry.call_with_retry(
  File "redis/asyncio/retry.py", line 62, in call_with_retry
    await fail(error)
  File "redis/asyncio/retry.py", line 59, in call_with_retry
    return await do()
  File "redis/asyncio/client.py", line 1215, in _execute_transaction
    await connection.send_packed_command(all_cmds)
  File "redis/asyncio/connection.py", line 763, in send_packed_command
    raise ConnectionError(

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions