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( 
at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException( 
at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog( 
at org.mariadb.jdbc.MySQLStatement.execute( 
at org.mariadb.jdbc.MySQLStatement.execute( 
at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke( 
at java.lang.reflect.Method.invoke( 
at com.glide.db.StatementWrapper.invoke( 




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.



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