Answer the question
In order to leave comments, you need to log in
Why is the database crashing and the entire Django server behind it?
I apologize in advance for the spam tags, but I don't know where to dig and what causes the error.
After running docker-compose up, 4 containers rise:
redis - I use only for django-channels
django - I start asgi, through uvicorn
postgesql
nginx
It normally connects to websocket and works, but after some time (about 100 minutes, it happened three times) nothing works anymore.
Attempts to enter the django admin end with this error (the screen was found on the network, but the error is exactly the same)
could not fork new process for connection: Resource temporarily unavailable django:
kex_exchange_identification: Connection closed by remote host
-bash: fork: retry: Resource temporarily unavailable
Answer the question
In order to leave comments, you need to log in
Launched docker stats
and began to use apishka as usual.
I noticed that every websocket connection I made increased the PIDS value of the above command for the Django container.
The description of the command in the docker documentation states that a large value of this column indicates that extra threads are being created inside the container.
Removed extra lines of govnokoda and now everything works.
Sounds like the server is running out of memory. It is worth monitoring its use, find where the leak is and fix it. Yes, and it would be nice to configure the server so that it does not allow this.
docker-compose 2.3 still allowed resource limits. Use it and set limits on the amount of available memory for containers.
Set up monitoring (node_exporter, Prometheus, Alertmanager, Grafana) see what happens to the server - here are the instructions: 1 CPU 1 GB - and I want monitoring, like the big uncles
PS
If you collected images based on Alpine, be careful, there is a surrogate instead of libc called musl which is very limited and can add various special effects similar to what you described.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question