[
https://issues.apache.org/jira/browse/FINERACT-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18075183#comment-18075183
]
Mansi Maurya commented on FINERACT-2590:
----------------------------------------
Hello [~adamsaghy] May I work on this issue.
> MultitenantFix for JournalEntryAggregation job
> ----------------------------------------------
>
> Key: FINERACT-2590
> URL: https://issues.apache.org/jira/browse/FINERACT-2590
> Project: Apache Fineract
> Issue Type: Bug
> Affects Versions: 1.14.0
> Reporter: Adam Saghy
> Assignee: Adam Saghy
> Priority: Major
>
> *+Problem+*
> JournalEntryAggregationJobWriter stores StepExecution as an instance field
> set via beforeStep(). As a singleton @Component, a single instance is shared
> across all concurrent step
> executions. In a multi-tenant environment, the following race condition
> occurs:
> # Tenant A calls beforeStep() → sets stepExecution to Tenant A's
> (jobExecId=101)
> # Tenant B calls beforeStep() → overwrites stepExecution to Tenant B's
> (jobExecId=202)
> # Tenant A calls write() → reads stepExecution which now holds Tenant B's
> jobExecId=202
> This causes Tenant A's journal entry summaries to be persisted with Tenant
> B's jobExecutionId, resulting in cross-tenant data corruption.
> *+Fix+*
> Adding @StepScope makes Spring Batch create a new writer instance per step
> execution, ensuring each tenant's stepExecution field is isolated. This is
> the standard Spring Batch pattern for writers that depend on step-level state.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)