SHR提交入职单报错,web前端提示的报错堆栈大致:Caused exception message is: Transaction[XID:48ED3162C2AE4FEA9C712FAD8355D3B1/48ED3162C2AE4FEA9C712FAD8355D3B1] has been marked ROLLBACK ONLY somewhere!
下载并查看apusic.log发现原因
1、更新t_bas_comfuncmenucache表发送死锁
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] Caused by: org.postgresql.util.PSQLException: ERROR: deadlock detected
Detail: Process 10019251 waits for ShareLock on transaction 16642521; blocked by process 10022369.
Process 10022369 waits for ShareLock on transaction 16642550; blocked by process 10019251.
Hint: See server log for query details.
Where: while updating tuple (5037,88) in relation "t_bas_comfuncmenucache"
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.bos.sql.shell.KDStatement.execute(KDStatement.java:480)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.apusic.jdbc.adapter.StatementHandle.execute(StatementHandle.java:245)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.uiframe.utils.MenuDbUtil.execute(MenuDbUtil.java:57)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.uiframe.utils.CustMenuAutoUpdateForDB.updateAllUserComMenuCach(CustMenuAutoUpdateForDB.java:449)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.uiframe.app.MainFunctionMenuControllerBean._updateAllUserComMenuCach(MainFunctionMenuControllerBean.java:2419)
...........
2、于是抛异常,内层将该异常try catch了,外层事务提交的时候就会打印这个异常堆栈
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] com.kingdee.bos.BOSException: CONFIG_EXCEPTION
Caused exception message is: Transaction[XID:48ED3162C2AE4FEA9C712FAD8355D3B1/48ED3162C2AE4FEA9C712FAD8355D3B1] has been marked ROLLBACK ONLY somewhere!
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.util.app.DbUtil.execute(DbUtil.java:248)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.portal.biz.facade.portal.facade.PortalCacheFacade.updateCacheFlag(PortalCacheFacade.java:28)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.portal.CallBackRolePermission.doChange(CallBackRolePermission.java:26)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.permission.app.plunin.PermissionChangeHelper.exceChange(PermissionChangeHelper.java:130)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.permission.app.plunin.PermissionChangeHelper.exceChange(PermissionChangeHelper.java:95)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.permission.app.UserRoleOrgManagerControllerBean.handleCallBack(UserRoleOrgManagerControllerBean.java:529)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.permission.app.UserRoleOrgManagerControllerBean._saveUserRoleOrgs(UserRoleOrgManagerControllerBean.java:937)
2021-10-19 09:50:30 閿欒 [con.err-Thread 339] at com.kingdee.eas.base.permission.app.AbstractUserRoleOrgManagerControllerBean.saveUserRoleOrgs(AbstractUserRoleOrgManagerControllerBean.java:159)
问题根因和解决方法:1中更新常用功能缓存表t_bas_comfuncmenucache(还有其他菜单缓存表等)发送死锁导致,将这些地方的逻辑修改成delete语句,避免后续死锁发生。
注:
当前861已修复补丁:PTM161822。
推荐阅读