[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-9595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15694870#comment-15694870
 ] 

ASF GitHub Bot commented on CLOUDSTACK-9595:
--------------------------------------------

Github user serg38 commented on the issue:

    https://github.com/apache/cloudstack/pull/1762
  
    @rafaelweingartner Tried tracing where  deadlock 5 originated. It seems 
both transactions are part of the same method fetchNewPublicIp in 
IpAddressManagerImpl  . Transactions are executed on different management 
servers. 
    Update is triggered through markPublicIpAsAllocated  method 
    
    Select seems to come from there as well  fetchNewPublicIp in 
IpAddressManagerImpl
    
            AssignIpAddressFromPodVlanSearch = 
_ipAddressDao.createSearchBuilder();
            AssignIpAddressFromPodVlanSearch.and("dc", 
AssignIpAddressFromPodVlanSearch.entity().getDataCenterId(), Op.EQ);
            AssignIpAddressFromPodVlanSearch.and("allocated", 
AssignIpAddressFromPodVlanSearch.entity().getAllocatedTime(), Op.NULL);
            SearchBuilder<VlanVO> podVlanSearch = 
_vlanDao.createSearchBuilder();
            podVlanSearch.and("type", podVlanSearch.entity().getVlanType(), 
Op.EQ);
            podVlanSearch.and("networkId", 
podVlanSearch.entity().getNetworkId(), Op.EQ);
            SearchBuilder<PodVlanMapVO> podVlanMapSB = 
_podVlanMapDao.createSearchBuilder();
            podVlanMapSB.and("podId", podVlanMapSB.entity().getPodId(), Op.EQ);
            AssignIpAddressFromPodVlanSearch.join("podVlanMapSB", podVlanMapSB, 
podVlanMapSB.entity().getVlanDbId(), 
AssignIpAddressFromPodVlanSearch.entity().getVlanId(),
                JoinType.INNER);
            AssignIpAddressFromPodVlanSearch.join("vlan", podVlanSearch, 
podVlanSearch.entity().getId(), 
AssignIpAddressFromPodVlanSearch.entity().getVlanId(), JoinType.INNER);
            AssignIpAddressFromPodVlanSearch.done();
    
    public IPAddressVO doInTransaction(TransactionStatus status) throws 
InsufficientAddressCapacityException {
                    StringBuilder errorMessage = new StringBuilder("Unable to 
get ip adress in ");
                    boolean fetchFromDedicatedRange = false;
                    List<Long> dedicatedVlanDbIds = new ArrayList<Long>();
                    List<Long> nonDedicatedVlanDbIds = new ArrayList<Long>();
    
                    SearchCriteria<IPAddressVO> sc = null;
                    if (podId != null) {
                        sc = **AssignIpAddressFromPodVlanSearch**.create();
                        sc.setJoinParameters("podVlanMapSB", "podId", podId);
                        errorMessage.append(" pod id=" + podId);
                    } else {
                        sc = AssignIpAddressSearch.create();
                        errorMessage.append(" zone id=" + dcId);
                    }



> Transactions are not getting retried in case of database deadlock errors
> ------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9595
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9595
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the 
> default.) 
>    Affects Versions: 4.8.0
>            Reporter: subhash yedugundla
>             Fix For: 4.8.1
>
>
> Customer is seeing occasional error 'Deadlock found when trying to get lock; 
> try restarting transaction' messages in their management server logs.  It 
> happens regularly at least once a day.  The following is the error seen 
> 2015-12-09 19:23:19,450 ERROR [cloud.api.ApiServer] 
> (catalina-exec-3:ctx-f05c58fc ctx-39c17156 ctx-7becdf6e) unhandled exception 
> executing api command: [Ljava.lang.String;@230a6e7f
> com.cloud.utils.exception.CloudRuntimeException: DB Exception on: 
> com.mysql.jdbc.JDBC4PreparedStatement@74f134e3: DELETE FROM 
> instance_group_vm_map WHERE instance_group_vm_map.instance_id = 941374
>       at com.cloud.utils.db.GenericDaoBase.expunge(GenericDaoBase.java:1209)
>       at sun.reflect.GeneratedMethodAccessor360.invoke(Unknown Source)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:606)
>       at 
> org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
>       at 
> com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
>       at 
> org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
>       at 
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
>       at 
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
>       at com.sun.proxy.$Proxy237.expunge(Unknown Source)
>       at 
> com.cloud.vm.UserVmManagerImpl$2.doInTransactionWithoutResult(UserVmManagerImpl.java:2593)
>       at 
> com.cloud.utils.db.TransactionCallbackNoReturn.doInTransaction(TransactionCallbackNoReturn.java:25)
>       at com.cloud.utils.db.Transaction$2.doInTransaction(Transaction.java:57)
>       at com.cloud.utils.db.Transaction.execute(Transaction.java:45)
>       at com.cloud.utils.db.Transaction.execute(Transaction.java:54)
>       at 
> com.cloud.vm.UserVmManagerImpl.addInstanceToGroup(UserVmManagerImpl.java:2575)
>       at 
> com.cloud.vm.UserVmManagerImpl.updateVirtualMachine(UserVmManagerImpl.java:2332)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to