maxking / docker-mailman

Dockerfiles for the Mailman suite.
https://asynchronous.in/docker-mailman/
MIT License
232 stars 103 forks source link

Signup ends in endless loop #443

Closed lexermal closed 1 year ago

lexermal commented 3 years ago

Hello everyone,

Thanks to this repo I was able to set up mailman with docker!

The thing is just, I can't get my head around one tricky error. The startup page of mailman web is accessible but right after signing up or resetting my password after the first setup it ends up with "An error occurred while processing your request.".

I looked into uwsgi-error.log and it throws this error:

Starting uWSGI 2.0.19.1 (64bit) on [Tue Mar 9 19:36:23 2021] compiled with version: 6.4.0 on 20 August 2020 15:54:29 os: Linux-4.19.0-5-amd64 #1 SMP Debian 4.19.37-5 (2019-06-19) nodename: mailman-web machine: x86_64 clock source: unix detected number of CPU cores: 1 current working directory: /opt/mailman-web detected binary path: /usr/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! setgid() to 101 setuid() to 100 chdir() to /opt/mailman-web your memory page size is 4096 bytes detected max file descriptor number: 1048576 building mime-types dictionary from file /etc/mime.types...1183 entry found lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address 0.0.0.0:8080 fd 8 uwsgi socket 1 bound to TCP address 0.0.0.0:8000 fd 9 Python version: 3.6.9 (default, Oct 17 2019, 11:17:29) [GCC 6.4.0] Python main interpreter initialized at 0x55ed3c9b96e0 python threads support enabled your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds [uwsgi-cron] command "./manage.py runjobs minutely" registered as cron task [uwsgi-cron] command "./manage.py runjobs quarter_hourly" registered as cron task [uwsgi-cron] command "./manage.py runjobs hourly" registered as cron task [uwsgi-cron] command "./manage.py runjobs daily" registered as cron task [uwsgi-cron] command "./manage.py runjobs monthly" registered as cron task [uwsgi-cron] command "./manage.py runjobs weekly" registered as cron task [uwsgi-cron] command "./manage.py runjobs yearly" registered as cron task mapped 145840 bytes (142 KB) for 1 cores Operational MODE: single process WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x55ed3c9b96e0 pid: 1 (default app) uWSGI is running in multiple interpreter mode spawned uWSGI master process (pid: 1) spawned uWSGI worker 1 (pid: 17, cores: 1) [uwsgi-daemons] spawning "./manage.py qcluster" (uid: 100 gid: 101) 19:36:27 [Q] INFO Q Cluster failed-summer-carbon-island starting. 19:36:27 [Q] INFO Process-1:1 ready for work at 20 19:36:27 [Q] INFO Process-1:2 monitoring at 21 19:36:27 [Q] INFO Process-1:3 pushing tasks at 22 19:36:27 [Q] INFO Process-1 guarding cluster failed-summer-carbon-island 19:36:27 [Q] INFO Q Cluster failed-summer-carbon-island running. --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 332, in pusher task_set = broker.dequeue() File "/usr/lib/python3.6/site-packages/django_q/brokers/orm.py", line 67, in dequeue if tasks: File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 278, in bool self._fetch_all() File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 55, in iter results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "/usr/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql cursor.execute(sql, params) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/lib/python3.6/site-packages/django/db/utils.py", line 89, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) django.db.utils.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/logging/init.py", line 994, in emit msg = self.format(record) File "/usr/lib/python3.6/logging/init.py", line 840, in format return fmt.format(record) File "/usr/lib/python3.6/logging/init.py", line 577, in format record.message = record.getMessage() File "/usr/lib/python3.6/logging/init.py", line 338, in getMessage msg = msg % self.args TypeError: not all arguments converted during string formatting Call stack: File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "/usr/lib/python3.6/site-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/usr/lib/python3.6/site-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, cmd_options) File "/usr/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, *options) File "/usr/lib/python3.6/site-packages/django_q/management/commands/qcluster.py", line 22, in handle q.start() File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 67, in start self.sentinel.start() File "/usr/lib/python3.6/multiprocessing/process.py", line 105, in start self._popen = self._Popen(self) File "/usr/lib/python3.6/multiprocessing/context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "/usr/lib/python3.6/multiprocessing/context.py", line 277, in _Popen return Popen(process_obj) File "/usr/lib/python3.6/multiprocessing/popen_fork.py", line 19, in init self._launch(process_obj) File "/usr/lib/python3.6/multiprocessing/popen_fork.py", line 73, in _launch code = process_obj._bootstrap() File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(self._args, self._kwargs) File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 157, in init self.start() File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 161, in start self.spawn_cluster() File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 235, in spawn_cluster self.pusher = self.spawn_pusher() File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 190, in spawn_pusher return self.spawn_process(pusher, self.task_queue, self.event_out, self.broker) File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 186, in spawn_process p.start() File "/usr/lib/python3.6/multiprocessing/process.py", line 105, in start self._popen = self._Popen(self) File "/usr/lib/python3.6/multiprocessing/context.py", line 223, in _Popen return _default_context.get_context().Process._Popen(process_obj) File "/usr/lib/python3.6/multiprocessing/context.py", line 277, in _Popen return Popen(process_obj) File "/usr/lib/python3.6/multiprocessing/popen_fork.py", line 19, in init self._launch(process_obj) File "/usr/lib/python3.6/multiprocessing/popen_fork.py", line 73, in _launch code = process_obj._bootstrap() File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run self._target(*self._args, **self._kwargs) File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 334, in pusher logger.error(e, traceback.format_exc()) Message: OperationalError('server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\n',) Arguments: ('Traceback (most recent call last):\n File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute\n return self.cursor.execute(sql, params)\npsycopg2.OperationalError: server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request.\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File "/usr/lib/python3.6/site-packages/django_q/cluster.py", line 332, in pusher\n task_set = broker.dequeue()\n File "/usr/lib/python3.6/site-packages/django_q/brokers/orm.py", line 67, in dequeue\n if tasks:\n File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 278, in bool\n self._fetch_all()\n File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 1242, in _fetch_all\n self._result_cache = list(self._iterable_class(self))\n File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 55, in iter\n results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)\n File "/usr/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql\n cursor.execute(sql, params)\n File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\n File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers\n return executor(sql, params, many, context)\n File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute\n return self.cursor.execute(sql, params)\n File "/usr/lib/python3.6/site-packages/django/db/utils.py", line 89, in exit\n raise dj_exc_value.with_traceback(traceback) from exc_value\n File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute\n return self.cu19:36:37 [Q] INFO Process-1:3 stopped pushing tasks 19:36:37 [Q] ERROR reincarnated pusher Process-1:3 after sudden death 19:36:37 [Q] INFO Process-1:4 pushing tasks at 23 --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) psycopg2.OperationalError: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.

The connection to postgres works from all containers and all hosts are able to access mailman-core.

This is the docker-compose.yml file:

version: '3.7'

services: core: image: maxking/mailman-core:0.3 hostname: mailman-core volumes:

  • /nfs/share/container_data/mailman/core:/opt/mailman/ stop_grace_period: 30s depends_on:
  • database environment:
  • DATABASE_URL=postgres://mailman:my_postgres_pw@mailman-database/mailmandb
  • DATABASE_TYPE=postgres
  • DATABASE_CLASS=mailman.database.postgresql.PostgreSQLDatabase
  • HYPERKITTY_API_KEY=my_hyperkitty_pw networks:
  • proxy-main

    web: image: maxking/mailman-web:0.3.6 hostname: mailman-web depends_on:

  • database networks:
  • proxy-main volumes:
  • /nfs/share/container_data/mailman/web:/opt/mailman-web-data environment:
  • DATABASE_TYPE=postgres
  • DATABASE_URL=postgres://mailman:my_postgres_pw@mailman-database/mailmandb
  • HYPERKITTY_API_KEY=my_hyperkitty_pw
  • SECRET_KEY=my_secret_key
  • UWSGI_STATIC_MAP=/static=/opt/mailman-web-data/static
  • SERVE_FROM_DOMAIN=lists.my.domain
  • SMTP_HOST=my.domain
  • SMTP_PORT=465
  • SMTP_HOST_USER=mailman@my.domain
  • SMTP_HOST_PASSWORD=my_smtp_pw
  • SMTP_USE_TLS=True
  • MAILMAN_ADMIN_USER=mailman-01
  • MAILMAN_ADMIN_EMAIL=lists-admin@my.domain deploy: labels:
  • "traefik.enable=true"
  • "traefik.http.routers.mm.rule=Host(mailman.my.domain)"
  • "traefik.http.routers.mm.tls.certresolver=le"
  • "traefik.http.routers.mm.entrypoints=websecure"
  • "traefik.http.services.mm.loadbalancer.server.port=8000"
  • "traefik.http.services.mm.loadbalancer.passhostheader=true"

    database: hostname: mailman-database environment: POSTGRES_DB: mailmandb POSTGRES_USER: mailman POSTGRES_PASSWORD: my_postgres_pw image: postgres:9.6.20 volumes:

  • /nfs/share/container_data/mailman/db:/var/lib/postgresql/data networks:
  • proxy-main

networks: proxy-main: external: true

I hope you can help me, I'm out of ideas.

szarnyasg commented 3 years ago

I think I ran into the same issue: the website starts but when I ask for a password reset, it waits for ~25 seconds, then times out and displays the "An error occurred while processing your request." message mentioned in other issues (#427, #444). I reproduced the error on two host machines (Ubuntu 20.04, Fedora 34).

I tried debugging the problem. I exposed Postgres's port from the database container. This way, I could access Postgres:

psql -U mailman -h localhost -p 5432 mailmandb

I turned on the logging in Postgres but it didn't show any entries - presumably, the requests fail before reaching the DB.

I tried switching to MySQL by using docker-compose-mysql.yaml but it exhibited the same issue. Here's the log entry in /opt/mailman/web/logs/uwsgi-error.log (this location is for the host machine's file system):

01:08:52 [Q] ERROR reincarnated pusher Process-1:5 after sudden death
01:08:52 [Q] INFO Process-1:6 pushing tasks at 1686
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "/usr/lib/python3.8/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/usr/lib/python3.8/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/usr/lib/python3.8/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (2006, 'MySQL server has gone away')

I tried both release 0.3.11 and the main branch (9409942a316524b30120713b2888fd9c42c233e7). Please advise on how to work around this issue.

maxking commented 3 years ago

Can you try using 0.3.10 images using Postgres and see if you are getting the same error?

maxking commented 1 year ago

Closing due to inactivity.