DeathGun44 opened a new pull request, #5429:
URL: https://github.com/apache/fineract/pull/5429

   ## Description
   
   Fixes thread accumulation issue in 
[applicationEventMulticaster](cci:1://file:///home/deathgun/fineract/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/SpringConfig.java:33:4-38:5)
 caused by `SimpleAsyncTaskExecutor` creating unbounded threads.
   
   ### Problem
   The existing `SimpleAsyncTaskExecutor` creates a new thread for every event, 
leading to thread exhaustion under load (200+ concurrent users). This causes 
JVM memory exhaustion and service outages.
   
   ### Solution
   - Replace `SimpleAsyncTaskExecutor` with bounded 
[ThreadPoolTaskExecutor](cci:1://file:///home/deathgun/fineract/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/async/SpringAsyncConfig.java:32:4-37:5)
   - Core pool: 20 threads, Max pool: 100 threads
   - Add `DelegatingSecurityContextAsyncTaskExecutor` wrapper for security 
context propagation
   - Graceful shutdown with task completion wait
   
   ### Testing
   - Application starts successfully
   - Events processed on `FineractEvent-*` thread pool
   - No thread accumulation observed
   
   ## Checklist
   
   - [x] Write the commit message as per [our 
guidelines](https://github.com/apache/fineract/blob/develop/CONTRIBUTING.md#pull-requests)
   - [x] Acknowledge that we will not review PRs that are not passing the build 
_("green")_
   - [x] Create/update [unit or integration 
tests](https://fineract.apache.org/docs/current/#_testing) for verifying the 
changes made.
   - [x] Follow our [coding 
conventions](https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions).
   - [x] Add required Swagger annotation and update API documentation (N/A - no 
API changes)
   - [x] [This PR must not be a "code dump"]
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to