Skip to content

Leak of connections to Redis #279

Closed
@simonbru

Description

@simonbru

We have an issue with daphne opening connections to redis and (sometimes) never closing them. After a while, daphne cannot accept new connection and raises either OSError(24, 'Too many open files') or MaxClientsError('ERR max number of clients reached').

This leak sometimes occurs when a WebsocketConsumer closes the connection before accepting it (i.e. it rejects the connection).

I created a micro project to help reproduce this issue: https://github.com/simonbru/channels-redis-issue

I can reproduce the leak on channels-redis>=3.3.0 but not channels-redis==3.2.0. To be more specific, I can reproduce the leak starting from this commit: 3656d87

Environment

  • Debian 10
  • Python 3.7
  • Redis 6.2.1

Python dependencies

  • aioredis==1.3.1
  • channels==3.0.4
  • channels-redis==3.3.0 (issue also occurs on latest commit: 781228c)
  • daphne==3.0.2
  • django==2.2.24

Configuration

  • Channel backend: channels_redis.core.RedisChannelLayer

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