V11 to V12 Upgrade and Migration Error -HELP!

Upgrading my V11 to V12 in VM as a test for future upgrades. I encountered this error when doing bench update --patch. Please can anyone help me sort this out. Thanks!

There was an issue while migrating the DocType: Sales Order Item

Traceback (most recent call last):
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/skserpnext/frappe-bench/apps/erpnext/erpnext/patches/v12_0/update_pricing_rule_fields.py”, line 27, in execute
frappe.reload_doc(module, ‘doctype’, child_doc, force=True)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/init.py”, line 861, in reload_doc
return frappe.modules.reload_doc(module, dt, dn, force=force, reset_permissions=reset_permissions)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/utils.py”, line 174, in reload_doc
return import_files(module, dt, dn, force=force, reset_permissions=reset_permissions)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 27, in import_files
reset_permissions=reset_permissions)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 32, in import_file
ret = import_file_by_path(path, force, pre_process=pre_process, reset_permissions=reset_permissions)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 66, in import_file_by_path
ignore_version=ignore_version, reset_permissions=reset_permissions)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/import_file.py”, line 141, in import_doc
doc.insert()
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 260, in insert
self.run_post_save_methods()
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 936, in run_post_save_methods
self.run_method(“on_update”)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 806, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1085, in composer
return composed(self, method, *args, **kwargs)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 1068, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/model/document.py”, line 803, in fn
return method_object(*args, **kwargs)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 282, in on_update
raise e
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py”, line 279, in on_update
frappe.db.updatedb(self.name, Meta(self))
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/mariadb/database.py”, line 295, in updatedb
db_table.sync()
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/schema.py”, line 37, in sync
self.alter()
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py”, line 86, in alter
raise e
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/mariadb/schema.py”, line 75, in alter
frappe.db.sql(query)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 171, in sql
self._cursor.execute(query)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 517, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 732, in _read_query_result
result.read()
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 1075, in read
first_packet = self.connection._read_packet()
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 657, in _read_packet
packet_header = self._read_bytes(4)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 707, in _read_bytes
CR.CR_SERVER_LOST, “Lost connection to MySQL server during query”)
pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query’)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 99, in
main()
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/commands/init.py”, line 26, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/commands/site.py”, line 286, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/migrate.py”, line 48, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 97, in execute_patch
frappe.db.rollback()
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 761, in rollback
self.sql(“rollback”)
File “/home/skserpnext/frappe-bench/apps/frappe/frappe/database/database.py”, line 171, in sql
self._cursor.execute(query)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 516, in query
self._execute_command(COMMAND.COM_QUERY, sql)
File “/home/skserpnext/frappe-bench/env/lib/python3.6/site-packages/pymysql/connections.py”, line 750, in _execute_command
raise err.InterfaceError(“(0, ‘’)”)
pymysql.err.InterfaceError: (0, ‘’)

Looks like your mysql is not reachable…typically caused by not having enough RAM available, or the DB subsystem has crashed/failed pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query’)

i was able to patch and migrate by adjusting mysql timeout and packets. now i encounter this error while login in. Blank Login.

Run the bench update again using
bench update --reset

Same result after bench update --reset.

Try bench build && bench migrate then do bench clear-cache

I also cleared Firefox Browser cache and that worked thank you for all your help!!!