[GH-ISSUE #1720] django.db.utils.OperationalError #1358

Closed
opened 2026-02-27 11:16:42 +03:00 by kerem · 2 comments
Owner

Originally created by @sorgonas on GitHub (Apr 19, 2019).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1720

Impacted versions

  • Modoboa: 1.13.1
  • installer used: Yes ?
  • Webserver: Nginx

Hello,
I get mail from my server with the error text:
Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_radicale/management/commands/generate_rights.py", line 105, in handle "rights_file_path", app="modoboa_radicale") File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/parameters/tools.py", line 186, in get_global_parameter return get_localconfig().parameters.get_value(name, app=app, **kwargs) File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/parameters/tools.py", line 169, in get_localconfig return core_models.LocalConfig.objects.first() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 567, in first objects = list((self if self.ordered else self.order_by('pk'))[:1]) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__ self._fetch_all() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 1121, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 887, in execute_sql cursor = self.connection.cursor() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor return self._cursor() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 229, in _cursor self.ensure_connection() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 189, in connect self.connection = self.get_new_connection(conn_params) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection connection = Database.connect(**conn_params) File "/srv/modoboa/env/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

I checked the port 5432 and is open, just do not know where the problem lies now.
netstat -laputen | grep 5432

`
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 110 544105934 551/postgres

tcp6 0 0 ::1:5432 :::* LISTEN 110 544105933 551/postgres
`

service postgresql status
● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled) Active: active (exited) since Fri 2019-04-19 08:52:48 EDT; 10min ago Process: 1243 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 1243 (code=exited, status=0/SUCCESS) CGroup: /system.slice/postgresql.service
can any of you help me out there?

Originally created by @sorgonas on GitHub (Apr 19, 2019). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1720 # Impacted versions * Modoboa: 1.13.1 * installer used: Yes ? * Webserver: Nginx Hello, I get mail from my server with the error text: ` Traceback (most recent call last): File "/srv/modoboa/instance/manage.py", line 22, in <module> execute_from_command_line(sys.argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line utility.execute() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa_radicale/management/commands/generate_rights.py", line 105, in handle "rights_file_path", app="modoboa_radicale") File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/parameters/tools.py", line 186, in get_global_parameter return get_localconfig().parameters.get_value(name, app=app, **kwargs) File "/srv/modoboa/env/local/lib/python2.7/site-packages/modoboa/parameters/tools.py", line 169, in get_localconfig return core_models.LocalConfig.objects.first() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 567, in first objects = list((self if self.ordered else self.order_by('pk'))[:1]) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__ self._fetch_all() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 1121, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 887, in execute_sql cursor = self.connection.cursor() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 254, in cursor return self._cursor() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 229, in _cursor self.ensure_connection() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection self.connect() File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 189, in connect self.connection = self.get_new_connection(conn_params) File "/srv/modoboa/env/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection connection = Database.connect(**conn_params) File "/srv/modoboa/env/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 130, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError: could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? ` I checked the port 5432 and is open, just do not know where the problem lies now. netstat -laputen | grep 5432 ` tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 110 544105934 551/postgres tcp6 0 0 ::1:5432 :::* LISTEN 110 544105933 551/postgres ` service postgresql status ` ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled) Active: active (exited) since Fri 2019-04-19 08:52:48 EDT; 10min ago Process: 1243 ExecStart=/bin/true (code=exited, status=0/SUCCESS) Main PID: 1243 (code=exited, status=0/SUCCESS) CGroup: /system.slice/postgresql.service ` can any of you help me out there?
kerem closed this issue 2026-02-27 11:16:42 +03:00
Author
Owner

@tonioo commented on GitHub (Apr 29, 2019):

@sorgonas I guess Modoboa and Postgres are hosted on the same server, right? Have you tried to restart postgres?

<!-- gh-comment-id:487523646 --> @tonioo commented on GitHub (Apr 29, 2019): @sorgonas I guess Modoboa and Postgres are hosted on the same server, right? Have you tried to restart postgres?
Author
Owner

@sorgonas commented on GitHub (Apr 29, 2019):

@tonioo yes I have both on the same server. I often had to restart this completely. At the moment I have not received any further mail regarding this, suddenly it has stopped appearing in the mail. hope this stays that way and has done itself ;-)

<!-- gh-comment-id:487535754 --> @sorgonas commented on GitHub (Apr 29, 2019): @tonioo yes I have both on the same server. I often had to restart this completely. At the moment I have not received any further mail regarding this, suddenly it has stopped appearing in the mail. hope this stays that way and has done itself ;-)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1358
No description provided.