Notifications

75 views

Issue

Symptoms

TASK record creation/updating are failing with following error message.

Lock wait timeout exceeded; try restarting transaction 
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction 
at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:149) 
at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106) 
at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:274) 
at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:302) 
at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:393) 
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:498) 
at com.glide.db.StatementWrapper.invoke(StatementWrapper.java:40) 

Release

All

Cause

Due to Gap lock on 'task' table.

Gap Locks

A gap lock is a lock on a gap between index records, or a lock on the gap before the first or after the last index record. For example, SELECT c1 FROM t WHERE c1 BETWEEN 10 and 20 FOR UPDATE; prevents other transactions from inserting a value of 15 into column t.c1, whether or not there was already any such value in the column, because the gaps between all existing values in the range are locked.

A gap might span a single index value, multiple index values, or even be empty.

Gap locks are part of the tradeoff between performance and concurrency, and are used in some transaction isolation levels and not others.

 

Resolution

Add index or if index limit is reached , remove the least unused index and add new index for the affected column.

Please contact ServiceNow Customer Support.

Additional Information

InnoDB Lock MySQL

Article Information

Last Updated:2019-08-02 20:38:04
Published:2019-08-01