Hi all, I have seen deadlock issues occurring during database transactions within our code. [1] is such a situation.
What is the best way to handle such cases? Should we retry from the code where we invoked the authorisation manager in this case (i.e. AF code) or should the authorisation manager do the retry or the DatabaseUtil class should handle this? [1] https://wso2.org/jira/browse/CLOUD-310 TID: [0] [SCC] [2014-10-27 06:56:21,093] ERROR {org.wso2.carbon.user.core.util.DatabaseUtil} - Error! Deadlock found when trying to get lock; try restarting transaction {org.wso2.carbon.user.core.util.DatabaseUtil} com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1066) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2818) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2157) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2460) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2377) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2361) at org.wso2.carbon.user.core.util.DatabaseUtil.updateDatabase(DatabaseUtil.java:542) at org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager.addAuthorizationForRole(JDBCAuthorizationManager.java:718) at org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager.authorizeRole(JDBCAuthorizationManager.java:358) at org.wso2.carbon.appfactory.stratos.services.AppFactoryResourceManagementService.authorizeAppIdRole(AppFactoryResourceManagementService.java:351) at org.wso2.carbon.appfactory.stratos.services.AppFactoryResourceManagementService.getRegistry(AppFactoryResourceManagementService.java:246) at org.wso2.carbon.appfactory.stratos.services.AppFactoryResourceManagementService.addOrUpdateResource(AppFactoryResourceManagementService.java:159) at org.wso2.carbon.appfactory.stratos.services.AppFactoryResourceManagementService.addOrUpdateResources(AppFactoryResourceManagementService.java:142) -- *Amila Maharachchi* Senior Technical Lead WSO2, Inc.; http://wso2.com Blog: http://maharachchi.blogspot.com Mobile: +94719371446
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev