[ 
https://issues.apache.org/jira/browse/FINERACT-1909?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Peter Santa updated FINERACT-1909:
----------------------------------
    Description: 
h1. Background

In our use case, Savings Account transactions have to be inserted, sometimes 
multiple transactions for the same account triggered by independent threads.

Tested on this commit hash: *{color:#000000}d21110f7b{color}*

{color:#000000}application.properties modified to:{color}

{{{color:#083080}resilience4j.retry.instances.executeCommand.max-attempts{color}={color:#067d17}${FINERACT_COMMAND_PROCESSING_RETRY_MAX_ATTEMPTS:20}{color}{color:#067d17}...{color}}}

{{{color:#083080}resilience4j.retry.instances.executeCommand.retryExceptions{color}={color:#067d17}${FINERACT_COMMAND_PROCESSING_RETRY_EXCEPTIONS:org.springframework.dao.CannotAcquireLockException,org.springframework.orm.ObjectOptimisticLockingFailureException,org.eclipse.persistence.exceptions.OptimisticLockException}{color}}}
h3. Build and run

./gradlew clean
./gradlew :fineract-provider:jibDockerBuild -x test 
docker compose up
h1. Phenomenon

Performing the following command 100 on 2 threads (sum: 200 deposit), by 
Postman runner:

POST 
{{{}url{}}}{color:#212121}/savingsaccounts/{color}{{{}savingsAccountId{}}}{color:#212121}/transactions?command=deposit{color}
{color:#000000}{{color}
{color:#000000} {color}{color:#a31515}"transactionDate"{color}{color:#000000}: 
{color}{color:#f26b3a}{ \\{currentDate}}{color}{color:#000000},{color}
{color:#000000} 
{color}{color:#a31515}"transactionAmount"{color}{color:#000000}: 
{color}{color:#098658}1000{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"paymentTypeId"{color}{color:#000000}: 
{color}{color:#f26b3a}{ \\{paymentTypeId}}{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"note"{color}{color:#000000}: 
{color}{color:#0451a5}""{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"dateFormat"{color}{color:#000000}: 
{color}{color:#0451a5}"yyyyMMdd"{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"locale"{color}{color:#000000}: 
{color}{color:#0451a5}"en"{color}
{color:#000000}}
h1. Expected result

Fineract retries the command if any of the configured exception is thrown, and 
all the transactions are performed successfully.
h1. Actual result

Deadlock. See the logs attached.

2 commands were unsuccessful from the 200 - not bad, but not enough for a core 
banking system.

  was:
h1. Background

In our use case, Savings Account transactions have to be inserted, sometimes 
multiple transactions for the same account triggered by independent threads.

Tested on this commit hash: *{color:#000000}d21110f7b{color}*

{color:#000000}application.properties modified to:{color}

{{{color:#083080}resilience4j.retry.instances.executeCommand.max-attempts{color}={color:#067d17}${FINERACT_COMMAND_PROCESSING_RETRY_MAX_ATTEMPTS:20}{color}{color:#067d17}...{color}}}

{{{color:#083080}resilience4j.retry.instances.executeCommand.retryExceptions{color}={color:#067d17}${FINERACT_COMMAND_PROCESSING_RETRY_EXCEPTIONS:org.springframework.dao.CannotAcquireLockException,org.springframework.orm.ObjectOptimisticLockingFailureException,org.eclipse.persistence.exceptions.OptimisticLockException}{color}}}
h3. Build and run

./gradlew clean
./gradlew :fineract-provider:jibDockerBuild -x test 
docker compose up
h1. Phenomenon

Performing the following command 100 on 2 threads (sum: 200 deposit), by 
Postman runner:

POST 
{{{}url{}}}{color:#212121}/savingsaccounts/{color}{{{}savingsAccountId{}}}{color:#212121}/transactions?command=deposit{color}
{color:#000000}{{color}
{color:#000000} {color}{color:#a31515}"transactionDate"{color}{color:#000000}: 
{color}{color:#f26b3a}{ \{currentDate}}{color}{color:#000000},{color}
{color:#000000} 
{color}{color:#a31515}"transactionAmount"{color}{color:#000000}: 
{color}{color:#098658}1000{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"paymentTypeId"{color}{color:#000000}: 
{color}{color:#f26b3a}{ \{paymentTypeId}}{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"note"{color}{color:#000000}: 
{color}{color:#0451a5}""{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"dateFormat"{color}{color:#000000}: 
{color}{color:#0451a5}"yyyyMMdd"{color}{color:#000000},{color}
{color:#000000} {color}{color:#a31515}"locale"{color}{color:#000000}: 
{color}{color:#0451a5}"en"{color}
{color:#000000}}
h1. Expected result

Fineract retries the command, and all the transaction ends successfully.
h1. Actual result

Deadlock. See the logs attached.

2 commands were unsuccessful from the 200 - not bad, but not enough for a core 
banking system.


> Retry feature for commands - deadlock
> -------------------------------------
>
>                 Key: FINERACT-1909
>                 URL: https://issues.apache.org/jira/browse/FINERACT-1909
>             Project: Apache Fineract
>          Issue Type: Bug
>          Components: Savings
>         Environment: Local.
> ./gradlew clean
> ./gradlew :fineract-provider:jibDockerBuild -x test 
> docker compose up
>            Reporter: Peter Santa
>            Priority: Critical
>         Attachments: Fineract_savings_deposit_retry_test-2x100.log, 
> application.properties
>
>
> h1. Background
> In our use case, Savings Account transactions have to be inserted, sometimes 
> multiple transactions for the same account triggered by independent threads.
> Tested on this commit hash: *{color:#000000}d21110f7b{color}*
> {color:#000000}application.properties modified to:{color}
> {{{color:#083080}resilience4j.retry.instances.executeCommand.max-attempts{color}={color:#067d17}${FINERACT_COMMAND_PROCESSING_RETRY_MAX_ATTEMPTS:20}{color}{color:#067d17}...{color}}}
> {{{color:#083080}resilience4j.retry.instances.executeCommand.retryExceptions{color}={color:#067d17}${FINERACT_COMMAND_PROCESSING_RETRY_EXCEPTIONS:org.springframework.dao.CannotAcquireLockException,org.springframework.orm.ObjectOptimisticLockingFailureException,org.eclipse.persistence.exceptions.OptimisticLockException}{color}}}
> h3. Build and run
> ./gradlew clean
> ./gradlew :fineract-provider:jibDockerBuild -x test 
> docker compose up
> h1. Phenomenon
> Performing the following command 100 on 2 threads (sum: 200 deposit), by 
> Postman runner:
> POST 
> {{{}url{}}}{color:#212121}/savingsaccounts/{color}{{{}savingsAccountId{}}}{color:#212121}/transactions?command=deposit{color}
> {color:#000000}{{color}
> {color:#000000} 
> {color}{color:#a31515}"transactionDate"{color}{color:#000000}: 
> {color}{color:#f26b3a}{ \\{currentDate}}{color}{color:#000000},{color}
> {color:#000000} 
> {color}{color:#a31515}"transactionAmount"{color}{color:#000000}: 
> {color}{color:#098658}1000{color}{color:#000000},{color}
> {color:#000000} {color}{color:#a31515}"paymentTypeId"{color}{color:#000000}: 
> {color}{color:#f26b3a}{ \\{paymentTypeId}}{color}{color:#000000},{color}
> {color:#000000} {color}{color:#a31515}"note"{color}{color:#000000}: 
> {color}{color:#0451a5}""{color}{color:#000000},{color}
> {color:#000000} {color}{color:#a31515}"dateFormat"{color}{color:#000000}: 
> {color}{color:#0451a5}"yyyyMMdd"{color}{color:#000000},{color}
> {color:#000000} {color}{color:#a31515}"locale"{color}{color:#000000}: 
> {color}{color:#0451a5}"en"{color}
> {color:#000000}}
> h1. Expected result
> Fineract retries the command if any of the configured exception is thrown, 
> and all the transactions are performed successfully.
> h1. Actual result
> Deadlock. See the logs attached.
> 2 commands were unsuccessful from the 200 - not bad, but not enough for a 
> core banking system.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to