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

Krishna Mewara updated FINERACT-2449:
-------------------------------------
    Environment: 
Platform:

OS: Linux / macOS / Windows (OS Agnostic)

Java Version: 17+ (Standard Fineract Runtime)

Framework: Spring Boot / Apache Fineract 1.x -> 1.14

Infrastructure:

Applicable to all deployment types (Local, Docker, Kubernetes).

Target: High-concurrency environments requiring bounded resource usage.

  was:
Reproducible on all environments (Local Development, Docker, and Kubernetes).

Platform:
- OS: Linux / macOS / Windows (OS Agnostic)
- Java Version: 17+ (Standard Fineract Runtime)
- Framework: Spring Boot / Apache Fineract 1.x -> 1.14

Infrastructure:
- Issue is critical in Containerized/Kubernetes environments where thread 
exhaustion leads to Pod Eviction/OOMKilled.
- High concurrency scenarios (>200 concurrent users) trigger the thread 
accumulation.


> Replace unbounded SimpleAsyncTaskExecutor with bounded ThreadPoolTaskExecutor
> -----------------------------------------------------------------------------
>
>                 Key: FINERACT-2449
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2449
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Performance
>    Affects Versions: 1.14.0
>         Environment: Platform:
> OS: Linux / macOS / Windows (OS Agnostic)
> Java Version: 17+ (Standard Fineract Runtime)
> Framework: Spring Boot / Apache Fineract 1.x -> 1.14
> Infrastructure:
> Applicable to all deployment types (Local, Docker, Kubernetes).
> Target: High-concurrency environments requiring bounded resource usage.
>            Reporter: Krishna Mewara
>            Priority: Major
>              Labels: improvement, performance, technical-debt, threading
>
> *Background* The current {{SimpleAsyncTaskExecutor}} creates a new thread for 
> every task. While effective for light loads, this unbounded behavior poses a 
> theoretical risk of thread exhaustion (OOM) under specific high-concurrency 
> scenarios (as originally reported in FINERACT-1934).
> *Motivation for Change* Although the specific "thread explosion" from 
> FINERACT-1934 is difficult to reproduce in standard local/CI environments, 
> relying on an unbounded executor is contrary to Spring Boot best practices 
> for production-grade financial systems.
> *Goal* Proactively replace the unbounded {{SimpleAsyncTaskExecutor}} with a 
> bounded, configurable {{{}ThreadPoolTaskExecutor{}}}. This ensures 
> deterministic resource usage and prevents any future possibility of thread 
> leaks, regardless of load.
> *Proposed Solution*
>  # Replace {{SimpleAsyncTaskExecutor}} with {{{}ThreadPoolTaskExecutor{}}}.
>  # Configure safe defaults (Core: CPU{_}2, Max: CPU{_}5).
>  # Implement robust unit tests (using {{CountDownLatch}} patterns) to 
> scientifically prove that the new pool respects bounds while maintaining 
> parallelism.
>  # Ensure compatibility with all Fineract Modes (Read/Write/Batch).



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

Reply via email to