Message: OperationalError(1226, "User has exceeded the 'max_connections_per_hour' resource (current value: 500)")

This issue has been tracked since 2023-01-08.

Deployment Method

  • Installer
  • Docker Development
  • Docker Production
  • Bare metal Development
  • Bare metal Production
  • Digital Ocean image
  • Other (please provide a link Steps to Reproduce

Describe the problem*

Hi Team,
I ran "docker compose up -d" after database seeding. My MySQL database resides in Hostinger which prevents maximum connections exceeding 500 per hour. Is there a way to specify in .env or other configuration files to limit the number of maximum connections made by inventree-server? No issues with database seeding only with inventree-server exceeding 500 connections per hour.
Thanks!
Gabriel

Steps to Reproduce

  1. docker volume rm -f inventree-production_inventree_data
  2. cd /home/ubuntu && mkdir inventree-data
  3. cd
  4. nano .env
    added external mysql host, db name, user, password and port
  5. nano docker-compose.override.yml
    added override for inventree-db and inventree-proxy
  6. docker-compose up -d
  7. docker logs inventree-server
    // showed the issue above on the logs

Relevant log output

Message: OperationalError(1226, "User has exceeded the 'max_connections_per_hour' resource (current value: 500)")
Arguments: ('Traceback (most recent call last):\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection\n    self.connect()\n  File "/root/.local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner\n    return func(*args, **kwargs)\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect\n    self.connection = self.get_new_connection(conn_params)\n  File "/root/.local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner\n    return func(*args, **kwargs)\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection\n    connection = Database.connect(**conn_params)\n  File "/usr/local/lib/python3.9/site-packages/MySQLdb/__init__.py", line 123, in Connect\n    return Connection(*args, **kwargs)\n  File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 185, in __init__\n    super().__init__(*args, **kwargs2)\nMySQLdb.OperationalError: (1226, "User \'u581858203_supply_bukirin\' has exceeded the \'max_connections_per_hour\' resource (current value: 500)")\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "/root/.local/lib/python3.9/site-packages/django_q/cluster.py", line 345, in pusher\n    task_set = broker.dequeue()\n  File "/root/.local/lib/python3.9/site-packages/django_q/brokers/orm.py", line 64, in dequeue\n    tasks = self.get_connection().filter(key=self.list_key, lock__lt=_timeout())[\n  File "/root/.local/lib/python3.9/site-packages/django_q/brokers/orm.py", line 20, in get_connection\n    if transaction.get_autocommit(\n  File "/root/.local/lib/python3.9/site-packages/django/db/transaction.py", line 25, in get_autocommit\n    return get_connection(using).get_autocommit()\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 389, in get_autocommit\n    self.ensure_connection()\n  File "/root/.local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner\n    return func(*args, **kwargs)\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection\n    self.connect()\n  File "/root/.local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__\n    raise dj_exc_value.with_traceback(traceback) from exc_value\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection\n    self.connect()\n  File "/root/.local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner\n    return func(*args, **kwargs)\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect\n    self.connection = self.get_new_connection(conn_params)\n  File "/root/.local/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner\n    return func(*args, **kwargs)\n  File "/root/.local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 234, in get_new_connection\n    connection = Database.connect(**conn_params)\n  File "/usr/local/lib/python3.9/site-packages/MySQLdb/__init__.py", line 123, in Connect\n    return Connection(*args, **kwargs)\n  File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 185, in __init__\n    super().__init__(*args, **kwargs2)\ndjango.db.utils.OperationalError: (1226, "User has exceeded the \'max_connections_per_hour\' resource (current value: 500)")\n',)
SchrodingersGat wrote this answer on 2023-01-11

Is there a way to specify in .env or other configuration files to limit the number of maximum connections made by inventree-server?

No, the number of required DB connections depends on how heavily the system is being used.

This problem seems outside of scope for us.

More Details About Repo
Owner Name inventree
Repo Name InvenTree
Full Name inventree/InvenTree
Language Python
Created Date 2017-03-23
Updated Date 2023-03-31
Star Count 2586
Watcher Count 61
Fork Count 411
Issue Count 141

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date