AFAIR, when this issue occurred, it was not under a load. This does not
occur on all execution. This is an intermittent issue. But I am thinking of
a way to code for failures and handle the situation.

On Mon, Nov 10, 2014 at 5:03 PM, Sumedha Rubasinghe <[email protected]>
wrote:

> How frequent is this? does this come with a load or even on single
> execution?
> SQL in concern here is following?
>
> DELETE FROM UM_ROLE_PERMISSION WHERE UM_ROLE_NAME=? AND UM_PERMISSION_ID =
> (SELECT UM_ID FROM UM_PERMISSION WHERE UM_RESOURCE_ID = ? AND UM_ACTION = ?
> AND UM_TENANT_ID=?) AND UM_TENANT_ID=? AND UM_DOMAIN_ID=(SELECT
> UM_DOMAIN_ID FROM UM_DOMAIN WHERE UM_TENANT_ID=? AND UM_DOMAIN_NAME=?)
>
>
>
> On Mon, Nov 10, 2014 at 2:55 PM, Amila Maha Arachchi <[email protected]>
> wrote:
>
>> 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
>>
>>
>
>
> --
> /sumedha
> m: +94 773017743
> b :  bit.ly/sumedha
>



-- 
*Amila Maharachchi*
Senior Technical Lead
WSO2, Inc.; http://wso2.com

Blog: http://maharachchi.blogspot.com
Mobile: +94719371446
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to