Score:0

channels-Redis Consumes 100% cpu and becomes unresponsive

cn flag
  • Ubuntu 20.04.3 LTS x86_64
  • channels-redis==3.2.0
  • Nginx -> Daphne -> redis/django
  • command to start: "sudo docker run -p 6379:6379 -d redis:5"
Django settings:

    'default': {
        'BACKEND': 'channels_redis.core.RedisChannelLayer',
        'CONFIG': {
            "hosts": [('127.0.0.1', 6379)],
        },
    },
}

The issue: After about 12 to 48 hours (roughly, different each time) redis-server (top command calls it "redis2" sometimes and "redis-server" other times) suddenly consumes all the CPU it can, more or less bricking the whole system. Redis-cli is totally unresponsive. Redis runs perfectly fine until then i.e. not being greedy with the CPU and doing the expected job.

Running "docker logs " yields the following (on normal CPU usage).

1:M 11 Dec 2021 18:18:58.137 # Background saving error
1:M 11 Dec 2021 18:19:04.051 * 1 changes in 3600 seconds. Saving...
1:M 11 Dec 2021 18:19:04.051 * Background saving started by pid 7098
7098:C 11 Dec 2021 18:19:04.052 # Failed opening the RDB file root (in server root dir /etc) for saving: Permission denied

That is being spammed to the console while it is running normally i.e. not max CPU.

Is this correct though? Why is "/etc" the server root? There is no "/etc/redis/..." or "/var/logs/redis..." either.

As well, the "Background saving started by pid 7098" is always a new pid. Counting up. So not sure if this eventually leads to its death.

I also linked up "grafana" to monitor it (just another server/utility resource monitor). At the point of max CPU usage, granfan can no longer get info from it. So it definitely dies.

Most importantly, where are the logs supposed to go? As said before, there is no /var/logs for redis in its docker container.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.