Hello Everyone, I have found the reason for ‘DeadlockLoserDataAccessException’. This is due to the concurrency problem(The second query getting exception while the first query in execution process in the same table).
I tried to solve the issue with @Synchronized annotation, but it took a lot of time to complete the whole process. So I tried Asynchronous annotation, but i don’t know where to configure in MIFOS.(also tried innodb_thread_concurrency setup in my.cnf file) Please help to fix the issue with Asynchronous or some other solution. Thanks and Regards, Ratheesh M On Thu, Sep 5, 2019 at 1:31 PM Ratheesh M <[email protected]> wrote: > Hi, > > I have an issue like ‘DeadlockLoserDataAccessException’ from last week. I > put a lot of effort to identifying the root cause of the issue. But still I > didn’t get any solution. Please help me to solve the issue. > > > -------------------------------------------------------------------------------------------------------------------------------------------------------- > > Aug 22 , 2019 3:12:06 PM > org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport reportFailedQuery > > WARNING: Failed Query Report SQL=Update m_loan_arrears_aging inner join > m_loan ml ON ml.id = loan_id SET ml.`loan_sub_status_id`= NULL where > ml.`id` = 10409451 and ml.`loan_sub_status_id`!= 100 or > ml.`loan_sub_status_id` IS NULL ;; time=347 ms; > > org.springframework.dao.DeadlockLoserDataAccessException: > StatementCallback; SQL [Update m_loan_arrears_aging inner join m_loan ml ON > ml.id = loan_id SET ml.`loan_sub_status_id`= NULL where ml.`id` = > 10409451 and ml.`loan_sub_status_id`!= 100 or ml.`loan_sub_status_id` IS > NULL ;]; Deadlock found when trying to get lock; try restarting transaction > {stmnt 1818628024 Update m_loan_arrears_aging inner join m_loan ml ON > ml.id = loan_id SET ml.`loan_sub_status_id`= NULL where ml.`id` = > 10409451 and ml.`loan_sub_status_id`!= 100 or ml.`loan_sub_status_id` IS > NULL ;} [code=1213, state=40001]; nested exception is > org.apache.openjpa.lib.jdbc.ReportingSQLException: Deadlock found when > trying to get lock; try restarting transaction {stmnt 1818628024 Update > m_loan_arrears_aging inner join m_loan ml ON ml.id = loan_id SET > ml.`loan_sub_status_id`= NULL where ml.`id` = 10409451 and > ml.`loan_sub_status_id`!= 100 or ml.`loan_sub_status_id` IS NULL ;} > [code=1213, state=40001] > > at > org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:263) > > at > org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) > > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:413) > > at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:546) > > at > org.apache.fineract.portfolio.loanaccount.service.LoanArrearsAgingServiceImpl.updateLoanArrearsAgeingDetails(LoanArrearsAgingServiceImpl.java:151) > > at > org.apache.fineract.portfolio.loanaccount.service.LoanArrearsAgingServiceImpl.businessEventWasExecuted(LoanArrearsAgingServiceImpl.java:609) > > at > org.apache.fineract.portfolio.common.service.BusinessEventNotifierServiceImpl.notifyBusinessEventWasExecuted(BusinessEventNotifierServiceImpl.java:71) > > at > org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestWritePlatformServiceImpl.approve(LoanRescheduleRequestWritePlatformServiceImpl.java:682) > > at sun.reflect.GeneratedMethodAccessor189.invoke(Unknown Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) > > at > org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) > > at > org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) > > at > org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) > > at com.sun.proxy.$Proxy272.approve(Unknown Source) > > at > org.apache.fineract.portfolio.loanaccount.rescheduleloan.handler.ApproveLoanRescheduleRequestCommandHandler.processCommand(ApproveLoanRescheduleRequestCommandHandler.java:44) > > at sun.reflect.GeneratedMethodAccessor183.invoke(Unknown Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) > > at > org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) > > at > org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) > > at > org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) > > at com.sun.proxy.$Proxy135.processCommand(Unknown Source) > > at > org.apache.fineract.commands.service.SynchronousCommandProcessingService.processAndLogCommand(SynchronousCommandProcessingService.java:88) > > at sun.reflect.GeneratedMethodAccessor181.invoke(Unknown Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) > > at > org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) > > at > org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) > > at > org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) > > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) > > at com.sun.proxy.$Proxy126.processAndLogCommand(Unknown Source) > > at > org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformServiceImpl.logCommandSource(PortfolioCommandSourceWritePlatformServiceImpl.java:98) > > at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:201) > > at com.sun.proxy.$Proxy127.logCommandSource(Unknown Source) > > at > org.apache.fineract.portfolio.loanaccount.rescheduleloan.api.RescheduleLoansApiResource.updateLoanRescheduleRequest(RescheduleLoansApiResource.java:157) > > at > org.apache.fineract.batch.command.internal.ApproveLoanRescheduleCommandStrategy.execute(ApproveLoanRescheduleCommandStrategy.java:58) > > at > org.apache.fineract.batch.service.BatchApiServiceImpl.handleBatchRequests(BatchApiServiceImpl.java:111) > > at > org.apache.fineract.batch.service.BatchApiServiceImpl.handleBatchRequestsWithoutEnclosingTransaction(BatchApiServiceImpl.java:181) > > at > org.apache.fineract.batch.api.BatchApiResource.handleBatchRequests(BatchApiResource.java:117) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:498) > > at > com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) > > at > com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185) > > at > com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) > > at > com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) > > at > com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) > > at > com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) > > at > com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391) > > at > com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381) > > at > com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) > > at > com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538) > > at > com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:731) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) > > at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) > > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:108) > > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) > > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) > > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) > > at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201) > > at > org.apache.fineract.infrastructure.security.filter.TenantAwareBasicAuthenticationFilter.doFilter(TenantAwareBasicAuthenticationFilter.java:150) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144) > > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) > > at > org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) > > at > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) > > at > org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:108) > > at > org.springframework.boot.context.web.ErrorPageFilter.access$000(ErrorPageFilter.java:58) > > at > org.springframework.boot.context.web.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:87) > > at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > > at > org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:100) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110) > > at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) > > at > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445) > > at > org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115) > > at > org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637) > > at > org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) > > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > > at > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) > > at java.lang.Thread.run(Thread.java:748) > > Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: Deadlock > found when trying to get lock; try restarting transaction {stmnt 1818628024 > Update m_loan_arrears_aging inner join m_loan ml ON ml.id = loan_id SET > ml.`loan_sub_status_id`= NULL where ml.`id` = 10409451 and > ml.`loan_sub_status_id`!= 100 or ml.`loan_sub_status_id` IS NULL ;} > [code=1213, state=40001] > > at > org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:218) > > at > org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:202) > > at > org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:58) > > at > org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:913) > > at > org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:118) > > at > org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelStatement.executeUpdate(JDBCStoreManager.java:1689) > > at > org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:118) > > at > org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:535) > > at > org.springframework.jdbc.core.JdbcTemplate$1UpdateStatementCallback.doInStatement(JdbcTemplate.java:532) > > at > org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:402) > > > Thanks and Regards, > Ratheesh M >
