Getting this error on submit Landed cost Voucher
taking too long to submit document if submitted by chance…
most of the time error in “select for update query in document.py”
erpnext 10.1.64
frappe 10.1.56
Traceback (most recent call last):
File “frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 833, in submit
self._submit()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 822, in _submit
self.save()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 310, in _save
self.run_post_save_methods()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 892, in run_post_save_methods
self.run_method(“on_submit”)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 757, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 1026, in composer
return composed(self, method, *args, **kwargs)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 1009, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 751, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “frappe-bench/apps/erpnext/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py”, line 107, in on_submit
self.update_landed_cost()
File “frappe-bench/apps/erpnext/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py”, line 131, in update_landed_cost
doc.update_stock_ledger(allow_negative_stock=True, via_landed_cost_voucher=True)
File “frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py”, line 397, in update_stock_ledger
via_landed_cost_voucher=via_landed_cost_voucher)
File “frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 265, in make_sl_entries
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
File “frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 23, in make_sl_entries
set_as_cancel(sl_entries[0].get(‘voucher_no’), sl_entries[0].get(‘voucher_type’))
File “frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 47, in set_as_cancel
(now(), frappe.session.user, voucher_type, voucher_no))
File “frappe-bench/apps/frappe/frappe/database.py”, line 166, in sql
self._cursor.execute(query, values)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 516, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 727, in _read_query_result
result.read()
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 1066, in read
first_packet = self.connection._read_packet()
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 683, in _read_packet
packet.check_error()
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (1205, u’Lock wait timeout exceeded; try restarting transaction’)
Traceback (most recent call last):
File “frappe-bench/apps/frappe/frappe/app.py”, line 62, in application
response = frappe.handler.handle()
File “frappe-bench/apps/frappe/frappe/handler.py”, line 22, in handle
data = execute_cmd(cmd)
File “frappe-bench/apps/frappe/frappe/handler.py”, line 53, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “frappe-bench/apps/frappe/frappe/init.py”, line 939, in call
return fn(*args, **newargs)
File “frappe-bench/apps/frappe/frappe/desk/form/save.py”, line 19, in savedocs
doc.submit()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 833, in submit
self._submit()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 822, in _submit
self.save()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 259, in save
return self._save(*args, **kwargs)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 310, in _save
self.run_post_save_methods()
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 892, in run_post_save_methods
self.run_method(“on_submit”)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 757, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 1026, in composer
return composed(self, method, *args, **kwargs)
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 1009, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “frappe-bench/apps/frappe/frappe/model/document.py”, line 751, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “frappe-bench/apps/erpnext/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py”, line 107, in on_submit
self.update_landed_cost()
File “frappe-bench/apps/erpnext/erpnext/stock/doctype/landed_cost_voucher/landed_cost_voucher.py”, line 131, in update_landed_cost
doc.update_stock_ledger(allow_negative_stock=True, via_landed_cost_voucher=True)
File “frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py”, line 397, in update_stock_ledger
via_landed_cost_voucher=via_landed_cost_voucher)
File “frappe-bench/apps/erpnext/erpnext/controllers/stock_controller.py”, line 265, in make_sl_entries
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
File “frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 23, in make_sl_entries
set_as_cancel(sl_entries[0].get(‘voucher_no’), sl_entries[0].get(‘voucher_type’))
File “frappe-bench/apps/erpnext/erpnext/stock/stock_ledger.py”, line 47, in set_as_cancel
(now(), frappe.session.user, voucher_type, voucher_no))
File “frappe-bench/apps/frappe/frappe/database.py”, line 166, in sql
self._cursor.execute(query, values)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/cursors.py”, line 170, in execute
result = self._query(query)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/cursors.py”, line 328, in _query
conn.query(q)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 516, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 727, in _read_query_result
result.read()
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 1066, in read
first_packet = self.connection._read_packet()
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/connections.py”, line 683, in _read_packet
packet.check_error()
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/protocol.py”, line 220, in check_error
err.raise_mysql_exception(self._data)
File “frappe-bench/env/lib/python2.7/site-packages/pymysql/err.py”, line 109, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (1205, u’Lock wait timeout exceeded; try restarting transaction’)