Skip to content

Instantly share code, notes, and snippets.

@saurabh2590
Created March 21, 2023 13:29
Show Gist options
  • Save saurabh2590/7fb848b8fa8288a85297a9d6bfe0e3a5 to your computer and use it in GitHub Desktop.
Save saurabh2590/7fb848b8fa8288a85297a9d6bfe0e3a5 to your computer and use it in GitHub Desktop.
Djangoexception
Traceback (most recent call last):
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 211, in execute
return self._trace_sql(self.__wrapped__.execute, sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 249, in _trace_sql
result = method(sql, params)
psycopg2.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
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 "/opt/rh/rh-python38/root/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauth2_provider/oauth2_validators.py", line 614, in save_bearer_token
access_token = self._create_access_token(
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauth2_provider/oauth2_validators.py", line 638, in _create_access_token
id_token = self._load_id_token(id_token)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauth2_provider/oauth2_validators.py", line 883, in _load_id_token
return IDToken.objects.get(jti=claims["jti"])
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 492, in get
num = len(clone)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 302, in __len__
self._fetch_all()
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1507, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 57, in __iter__
results = compiler.execute_sql(
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1361, in execute_sql
cursor.execute(sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 103, in execute
return super().execute(sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 211, in execute
return self._trace_sql(self.__wrapped__.execute, sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 249, in _trace_sql
result = method(sql, params)
django.db.utils.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
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 "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 244, in ensure_connection
self.connect()
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 225, in connect
self.connection = self.get_new_connection(conn_params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 203, in get_new_connection
connection = Database.connect(**conn_params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 281, in call_if_sampling
return self.call(module, method, wrapped, instance, args, kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/psycopg2.py", line 100, in call
return PGConnectionProxy(wrapped(*args, **kwargs), destination_info=destination_info)
File "/opt/rh/rh-python38/root/usr/local/lib64/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "10.7.224.2", port 5432 failed: session is read-only
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 84, in view
return self.dispatch(request, *args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/views/generic/base.py", line 119, in dispatch
return handler(request, *args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/views/decorators/debug.py", line 92, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauth2_provider/views/base.py", line 261, in post
url, headers, body, status = self.create_token_response(request)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauth2_provider/views/mixins.py", line 124, in create_token_response
return core.create_token_response(request)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauth2_provider/oauth2_backends.py", line 156, in create_token_response
headers, body, status = self.server.create_token_response(
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/endpoints/base.py", line 112, in wrapper
return f(endpoint, uri, *args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/endpoints/token.py", line 114, in create_token_response
return grant_type_handler.create_token_response(
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauthlib/openid/connect/core/grant_types/dispatchers.py", line 101, in create_token_response
return handler.create_token_response(request, token_handler)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py", line 312, in create_token_response
self.request_validator.save_token(token, request)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/request_validator.py", line 315, in save_token
return self.save_bearer_token(token, request, *args, **kwargs)
File "/opt/rh/rh-python38/root/usr/lib64/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/transaction.py", line 299, in __exit__
connection.set_autocommit(True)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 434, in set_autocommit
self.ensure_connection()
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 244, in ensure_connection
self.connect()
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 244, in ensure_connection
self.connect()
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 225, in connect
self.connection = self.get_new_connection(conn_params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 203, in get_new_connection
connection = Database.connect(**conn_params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 281, in call_if_sampling
return self.call(module, method, wrapped, instance, args, kwargs)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/psycopg2.py", line 100, in call
return PGConnectionProxy(wrapped(*args, **kwargs), destination_info=destination_info)
File "/opt/rh/rh-python38/root/usr/local/lib64/python3.8/site-packages/psycopg2/__init__.py", line 122, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: connection to server at "10.7.224.2", port 5432 failed: session is read-only
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment