[Django] #33087: Postgres: SSL connection has been closed unexpectedly

37 views
Skip to first unread message

Django

unread,
Sep 8, 2021, 5:20:54 AM9/8/21
to django-...@googlegroups.com
#33087: Postgres: SSL connection has been closed unexpectedly
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
Daveson217 |
Type: Bug | Status: new
Component: | Version: 3.2
Uncategorized |
Severity: Normal | Keywords: Postgres, heroku
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I recently deployed an app to Heroku using Postgres free tier as database.
I am using Django 3.2 Everything was working fine until I started getting
a mail with the following error:


{{{
OperationalError at /blog/create/
terminating connection due to administrator command
SSL connection has been closed unexpectedly
}}}

It happens when I try to save a Post.
I know it's an issue with the Postgres, but I don't know what it means or
how to solve it.

1. What does this error mean?
2. What causes the error?
3. How can I solve it?

This is the full error trace

{{{
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/sessions/backends/base.py", line 233, in
_get_session
return self._session_cache

During handling of the above exception ('SessionStore' object has no
attribute '_session_cache'), another exception occurred:
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)

The above exception (terminating connection due to administrator command
SSL connection has been closed unexpectedly
) was the direct cause of the following exception:
File "/app/.heroku/python/lib/python3.8/site-
packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/auth/decorators.py", line 20, in _wrapped_view
if test_func(request.user):
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/auth/decorators.py", line 44, in <lambda>
lambda u: u.is_authenticated,
File "/app/.heroku/python/lib/python3.8/site-
packages/django/utils/functional.py", line 246, in inner
self._setup()
File "/app/.heroku/python/lib/python3.8/site-
packages/django/utils/functional.py", line 382, in _setup
self._wrapped = self._setupfunc()
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/auth/middleware.py", line 23, in <lambda>
request.user = SimpleLazyObject(lambda: get_user(request))
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/auth/middleware.py", line 11, in get_user
request._cached_user = auth.get_user(request)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/auth/__init__.py", line 177, in get_user
user_id = _get_user_session_key(request)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/auth/__init__.py", line 60, in
_get_user_session_key
return
get_user_model()._meta.pk.to_python(request.session[SESSION_KEY])
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/sessions/backends/base.py", line 65, in
__getitem__
return self._session[key]
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/sessions/backends/base.py", line 238, in
_get_session
self._session_cache = self.load()
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/sessions/backends/db.py", line 43, in load
s = self._get_session_from_db()
File "/app/.heroku/python/lib/python3.8/site-
packages/django/contrib/sessions/backends/db.py", line 32, in
_get_session_from_db
return self.model.objects.get(
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/models/query.py", line 431, in get
num = len(clone)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/models/query.py", line 262, in __len__
self._fetch_all()
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/models/query.py", line 1324, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/models/query.py", line 51, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch,
chunk_size=self.chunk_size)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False,
executor=self._execute)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/app/.heroku/python/lib/python3.8/site-
packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33087>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 8, 2021, 5:21:58 AM9/8/21
to django-...@googlegroups.com
#33087: Postgres: SSL connection has been closed unexpectedly
----------------------------------+--------------------------------------
Reporter: Daveson217 | Owner: Daveson217
Type: Bug | Status: assigned
Component: Uncategorized | Version: 3.2
Severity: Normal | Resolution:
Keywords: Postgres, heroku | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Daveson217):

* owner: nobody => Daveson217
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/33087#comment:1>

Django

unread,
Sep 8, 2021, 5:25:41 AM9/8/21
to django-...@googlegroups.com
#33087: Postgres: SSL connection has been closed unexpectedly
----------------------------------+--------------------------------------
Reporter: Daveson217 | Owner: (none)
Type: Bug | Status: new

Component: Uncategorized | Version: 3.2
Severity: Normal | Resolution:
Keywords: Postgres, heroku | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Daveson217):

* owner: Daveson217 => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/33087#comment:2>

Django

unread,
Sep 8, 2021, 5:27:28 AM9/8/21
to django-...@googlegroups.com
#33087: Postgres: SSL connection has been closed unexpectedly
-------------------------------------+-------------------------------------
Reporter: Daveson217 | Owner: (none)
Type: Bug | Status: new
Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution:

Keywords: Postgres, heroku | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Daveson217):

* component: Uncategorized => Database layer (models, ORM)


--
Ticket URL: <https://code.djangoproject.com/ticket/33087#comment:3>

Django

unread,
Sep 8, 2021, 5:39:37 AM9/8/21
to django-...@googlegroups.com
#33087: Postgres: SSL connection has been closed unexpectedly
-------------------------------------+-------------------------------------
Reporter: David Babalola | Owner: (none)
Type: Bug | Status: closed

Component: Database layer | Version: 3.2
(models, ORM) |
Severity: Normal | Resolution: invalid

Keywords: Postgres, heroku | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

See TicketClosingReasons/UseSupportChannels for ways to get help. If you
confirm a bug in Django, please reopen with details.

--
Ticket URL: <https://code.djangoproject.com/ticket/33087#comment:4>

Reply all
Reply to author
Forward
0 new messages