CannotAcquireLockExceptionis shown several times in the server log:
SQL [INSERT INTO Users_UserGroups (userGroupId, userId) VALUES (?, ?)];
Unknown error 1205; nested exception is java.sql.SQLException: Unknown error 1205
- Portal 6.2
If this error appears in the log, it indicates that the database cannot get a lock for
Users_UserGroupstable to execute the
If MySQL is used as database and many
SELECTqueries are being executed on the Users_UserGroups table, the database may prioritize the
SELECTqueries and wait for them to be executed before execute the
If this timeout exceeds the time specified in the MySQL's
innodb_lock_wait_timeoutproperty, the CannotAcquireLockException error occurs.
- It is possible to reduce the number of
SELECTqueries executed on the database by adding the affected table to the
table.mapper.cache.mapping.table.namesproperty in the
portal-ext.properties, in which case the queries to this table will be cached by the portal:
table.mapper.cache.mapping.table.names=Users_UserGroupsIt will be necessary to restart the portal for the new value to be applied.
- As of 6.2 Fix pack Portal 108, this property was changed to
table.mapper.cacheless.mapping.table.names, being by default the opposite behavior, i.e., all tables are cached and only the tables specified in this property will be executed against the database.