FATAL: sorry, too many clients already
See original GitHub issueEnvironment
- Python version: 3.8.5
- Nautobot version: 1.0.0b2
Steps to Reproduce
- invoke debug
- Add some data using nautobot-ansible (pynautobot) - running on localhost
Questions:
- How to increase the number of allowed clients?
- How to check if everything is processed before sending a new request?
- name: "ANSIBLE PLAYBOOK - Add Nautobot Configuration"
connection: local
hosts: localhost
gather_facts: False
collections:
- networktocode.nautobot
vars:
# nautobot_token see group_vars/all
nbtoken: "{{ lookup('env', 'NAUTOBOT_TOKEN') if lookup('env', 'NAUTOBOT_TOKEN')|default(false) else nautobot_token }}"
nburl: "{{ lookup('env', 'NAUTOBOT_URL') if lookup('env', 'NAUTOBOT_URL')|default(false) else nautobot_url }}"
include_dir: "./include"
snapshot_dir: "~/snapshot-transfer"
tasks:
- name: "Import ansible Fabric-Vars"
include_vars:
dir: vars/fabric
- name: "Add Tags in Nautobot (nautobot_tags.yml)"
networktocode.nautobot.tag:
url: "{{ nburl }}"
token: "{{ nbtoken }}"
validate_certs: yes
state: present
data: "{{ item }}"
loop: "{{ nbtags }}"
Data for import: ./vars/fabric/nautobot-tags.yml
nbtags:
- { name: "name1", slug: "name1", description: "Tag name1", color: '4caf50' }
- ...
Expected Behavior
Import all tags.
Observed Behavior
Environment:
Request Method: GET
Request URL: http://scvpconf01:8000/extras/tags/
Django Version: 3.1.7
Python Version: 3.8.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'cacheops',
'corsheaders',
'django_filters',
'django_tables2',
'django_prometheus',
'mptt',
'rest_framework',
'social_django',
'taggit',
'timezone_field',
'nautobot.core',
'nautobot.circuits',
'nautobot.dcim',
'nautobot.ipam',
'nautobot.extras',
'nautobot.tenancy',
'nautobot.users',
'nautobot.utilities',
'nautobot.virtualization',
'django_rq',
'drf_yasg',
'graphene_django',
'debug_toolbar']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'nautobot.core.middleware.ExceptionHandlingMiddleware',
'nautobot.core.middleware.RemoteUserMiddleware',
'nautobot.core.middleware.ExternalAuthMiddleware',
'nautobot.core.middleware.APIVersionMiddleware',
'nautobot.core.middleware.ObjectChangeMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware']
Traceback (most recent call last):
File "/usr/local/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 "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
The above exception (FATAL: sorry, too many clients already
) was the direct cause of the following exception:
File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.8/site-packages/debug_toolbar/middleware.py", line 67, in __call__
panel.generate_stats(request, response)
File "/usr/local/lib/python3.8/site-packages/debug_toolbar/panels/request.py", line 57, in generate_stats
for k in sorted(request.session.keys())
File "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 169, in keys
return self._session.keys()
File "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/base.py", line 238, in _get_session
self._session_cache = self.load()
File "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py", line 43, in load
s = self._get_session_from_db()
File "/usr/local/lib/python3.8/site-packages/django/contrib/sessions/backends/db.py", line 32, in _get_session_from_db
return self.model.objects.get(
File "/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 "/usr/local/lib/python3.8/site-packages/cacheops/query.py", line 353, in get
return qs._no_monkey.get(qs, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 425, in get
num = len(clone)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 269, in __len__
self._fetch_all()
File "/usr/local/lib/python3.8/site-packages/cacheops/query.py", line 273, in _fetch_all
return self._no_monkey._fetch_all(self)
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 1308, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/usr/local/lib/python3.8/site-packages/django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/usr/local/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1154, in execute_sql
cursor = self.connection.cursor()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 259, in cursor
return self._cursor()
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
self.ensure_connection()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/local/lib/python3.8/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
connection = Database.connect(**conn_params)
File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
Exception Type: OperationalError at /extras/tags/
Exception Value: FATAL: sorry, too many clients already
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
org.postgresql.util.PSQLException: FATAL: sorry, too many ...
An explanation of the following error: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already. Summary: You opened up more than the ...
Read more >How to resolve PostgreSQL 'FATAL: sorry, too many clients ...
There could be a leak, the client connections aren't properly closed on the backend side, so find out why is that. Use a...
Read more >psql: FATAL: sorry, too many clients already
This seems to be client programming specific problem. You won't be able to fix this by e.g. raising "max_connections" parameter.
Read more >“Sorry, too many clients already” - How to Use PgPool to Solve ...
Simply put, this error appears when the number of clients connected to the database exceeds the concurrent limit max_connections defined in the ...
Read more >org.postgresql.util.PSQLException ... - Atlassian Documentation
Last acquisition attempt exception: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this would be valuable to have in the developer documentation in a “troubleshooting” section.
Ahhh I should have caught that when you said you did
invoke debug
.If you’re trying to do any legit data or performance testing, you might start bumping into issues like this with
runserver
since it’s not the most performant.