How to fix this error during updating

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 114, in <module>
    main()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 20, in main
    click.Group(commands=commands)(prog_name="bench")
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1442, in __call__
    return self.main(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1363, in main
    rv = self.invoke(ctx)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1830, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1226, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 794, in invoke
    return callback(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py", line 34, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/commands/site.py", line 683, in migrate
    SiteMigration(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 193, in run
    self.run_schema_updates()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 54, in wrapper
    raise e
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 46, in wrapper
    ret = method(*args, **kwargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/migrate.py", line 123, in run_schema_updates
    frappe.model.sync.sync_all()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/sync.py", line 44, in sync_all
    sync_for(app, force, reset_permissions=reset_permissions)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/sync.py", line 112, in sync_for
    import_file_by_path(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 146, in import_file_by_path
    import_doc(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 239, in import_doc
    doc.insert()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 304, in insert
    self.set_new_name(set_name=set_name, set_child_names=set_child_names)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 549, in set_new_name
    set_new_name(d)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/naming.py", line 150, in set_new_name
    meta = frappe.get_meta(doc.doctype)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 1338, in get_meta
    return frappe.model.meta.get_meta(doctype, cached=cached)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py", line 71, in get_meta
    meta = Meta(doctype)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py", line 125, in __init__
    super().__init__("DocType", doctype)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 126, in __init__
    self.load_from_db()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/meta.py", line 131, in load_from_db
    super().load_from_db()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 174, in load_from_db
    d = frappe.db.get_value(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database/database.py", line 514, in get_value
    result = self.get_values(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database/database.py", line 618, in get_values
    out = self._get_values_from_table(
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database/database.py", line 891, in _get_values_from_table
    return query.run(as_dict=as_dict, debug=debug, update=update, run=run, pluck=pluck)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/query_builder/utils.py", line 87, in execute_query
    result = frappe.db.sql(query, params, *args, **kwargs)  # nosemgrep
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database/database.py", line 230, in sql
    self._cursor.execute(query, values)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/pymysql/cursors.py", line 153, in execute
    result = self._query(query)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/pymysql/cursors.py", line 322, in _query
    conn.query(q)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py", line 562, in query
    self._execute_command(COMMAND.COM_QUERY, sql)
  File "/home/ubuntu/frappe-bench/env/lib/python3.10/site-packages/pymysql/connections.py", line 843, in _execute_command
    raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')

Any Solution?

Hi,

It may help to say the version of Frappe and Erpnext and if updates have been successful previously.

The error suggests a database connection error. Does bench –site (sitename) mariadb connect to the mariadb server?

it is still working normally but not being updated

Please check the maximum used connections and compare them with the configured max connections.

Note: This issue can usually be resolved simply by restarting the services.