-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database connection closes unexpectedly #184
Comments
Hi, What are you trying to achieve by enabling threading support/limiting the uwsgi process? (sorry I am not really an expert in this topic). Can you please share the UWSGI configuration that i can try to replicate this issue on side? BR G. |
The communication with our PKI takes some time when issuing certificates. I wanted to serve multiple requests in parallel so I've enabled threading here. I've read, however, that uWSGI threading might create some issues with database connections. I'll test if disabling threading fixes the problem. |
It seems that the error occurs regardless of the thread and process configuration. I've tried to reduce it to 1 thread and 1 process but the error persists. Whenever I start the service and let it run for a couple of hours then the error will occur. |
can you please describe your environment a bid more in detail? I am especially interested in:
|
Hey, I'm running acme2certifier in a Kubernetes environment. acme2certifier is deployed as deployment and I use a NGINX reverse proxy. Here is the Docker build file for the acme2certifier container FROM debian:12.5-slim as build
# python3 general requirement for acme2certifier
# uwsgi WSGI runtime server for acme2certifier
# uwsgi-plugin-python3 plugin for uwsgi for python support
# python3-impacket required for CA handler for Microsoft Windows Client Certificate Enrollment Protocol
RUN apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y --no-install-recommends \
wget \
ca-certificates \
python3 \
uwsgi \
uwsgi-plugin-python3 \
python3-django \
python3-psycopg2 \
python3-impacket &&\
apt-get clean
RUN wget -O /acme2certifier.deb https://github.com/grindsa/acme2certifier/releases/download/0.34/acme2certifier_0.34-1_all.deb &&\
apt-get --fix-broken -y install /acme2certifier.deb &&\
rm /acme2certifier.deb
RUN apt-get -y remove wget
COPY build/root /
RUN mkdir /var/www/acme2certifier/volume/
# Copy some django stuff into acme2certifier root folder
RUN cp -R /var/www/acme2certifier/examples/django/* /var/www/acme2certifier/
# Overwrite the DB handler script to be a django db handler
RUN cp /var/www/acme2certifier/examples/db_handler/django_handler.py /var/www/acme2certifier/acme_srv/db_handler.py
COPY ./build/misc/django_settings.py /var/www/acme2certifier/acme2certifier/settings.py
RUN chown www-data:www-data -R /var/www/acme2certifier
FROM build as live
# First, harden the container by specifying a non root user
USER www-data
WORKDIR /var/www/acme2certifier
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD [ "uwsgi", "--plugin", "python3", "acme2certifier.uswgi.ini" ] The entrypoint of the Docker container looks like this: #!/bin/bash
set -e
echo "apply migrations" >> /proc/1/fd/1
python3 /var/www/acme2certifier/tools/django_update.py
python3 manage.py loaddata acme_srv/fixture/status.yaml
chown -R www-data /var/www/acme2certifier/volume
chmod u+s /var/www/acme2certifier/volume/
exec "$@" The database is located on another server in the same network. But even if there were network outages, I would expect a2c to recover itself, e.g. try to reconnect to the server, which does not happen. Instead I have to manually restart the application. |
Hi, i am sorry but still not able to replicate your issue. Can you try to replicate the issue with one of the a2c containers available at docker-hub |
Hi,
I'm running acme2certifier with Django and uwsgi behind a NGINX reverse proxy. Here are my server configuration files:
Django Settings
UWSGI Configuration File
NGINX Sever Section
My problem is that after running for a couple of hours, acme2certifier seems to loose connection to the PostgreSQL database. Here is the error message:
A restart of the service solves the problem so I'm pretty sure that this is not a problem with the DB itself.
I'm a bit unsure if there is some sort of keep-alive mechanism not working properly and which component might be configured wrongly.
I've activated threading support on UWSGI and limited the number of processes to 1, so might this be a problem?
Anyway, any help is highly appreciated.
BR Kai
The text was updated successfully, but these errors were encountered: