Error while updating template item

Hello dears
i`m facing the following error while update a template item with a huge number of variants

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 286, in _save
self.check_if_latest()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 612, in check_if_latest
where name = %s for update""".format(self.doctype), self.name, as_dict=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 166, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 166, in execute
result = self._query(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 856, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1057, in _read_query_result
result.read()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1340, in read
first_packet = self.connection._read_packet()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1014, in _read_packet
packet.check_error()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 393, in check_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (1205, u’Lock wait timeout exceeded; try restarting transaction’)

Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 939, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 22, in savedocs
doc.save()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 256, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 286, in _save
self.check_if_latest()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 612, in check_if_latest
where name = %s for update""".format(self.doctype), self.name, as_dict=True)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database.py”, line 166, in sql
self._cursor.execute(query, values)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 166, in execute
result = self._query(query)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/cursors.py”, line 322, in _query
conn.query(q)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 856, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1057, in _read_query_result
result.read()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1340, in read
first_packet = self.connection._read_packet()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 1014, in _read_packet
packet.check_error()
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/connections.py”, line 393, in check_error
err.raise_mysql_exception(self._data)
File “/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/pymysql/err.py”, line 107, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (1205, u’Lock wait timeout exceeded; try restarting transaction’)
Report this issue

please help !!

Two options you might try -

  1. split up the import file - assuming that is the problem and might work!?

  2. increase the timeout period JobTimeoutException: Job exceeded maximum timeout value (300 seconds)

I cannot speak from experience with either one!

iv reduced the variants settings from around 30 rows to only 10 rows and its seems like working !

hey @Mahmoud_Ghoneem,
What version of ERPNext are you on? The version 10 (Released 4 days ago) has an "Enhanced Data Import Tool". I was able to import about 18000 rows (Yes, that is not a typo- Eighteen Thousand) in one shot (You guys are awesome - Team ERPNext). It took 29 minutes and went through successfully.

I urge you to update to version 10 and try again. (in case you are already on version 10, i guess this post is irreverent to you)

PS: in the post mentioned by @clarkej. there is some mention about “JobTimeException” and “innodb lock related exception”. So, i am not sure if these two are seperate issues and if they are solved in the version 10. Either way Please, do add you experience here if you upgrade to version 10 and retry this.

yes i`m in v10 and !!

Same problem here so i can`t manage my data !!

also made

Run this:

SET GLOBAL innodb_lock_wait_timeout = 5000;
And then this:

SET innodb_lock_wait_timeout = 5000;

@Mahmoud_Ghoneem, sorry i am unable to understand what is going on.

Is the problem resolved for you?
are you getting the same error on version 10?
how long does it take for the error to appear after you start your upload?
does your error have anything in common with this post?

i`m facing this error while updating template item not uploading …

my new database structure designed as a templet item with a minimum 200 variants

so when i update any infos in the templet item it copies that data to its variants

here error appears not while uploading

Oops!! Sorry i misunderstood your initial question. My bad… I have drowned in the “Data Import Tool” lately, I guess it is the effect of that :sweat_smile:

I haven’t had a case of more than 10 item variants in my case. So, i know nothing about your problem here. :blush:

Over and Out. :smiley:

Thank U BTW for your reply

@Mahmoud_Ghoneem Speaking of drowning in “Data Import Tool” :grin:
have you tried to export all the items, then make the changes and then uploading the edited items using “data import tool”?