[
https://issues.apache.org/jira/browse/FINERACT-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Saghy resolved FINERACT-2590.
----------------------------------
Fix Version/s: 1.15.0
Resolution: Fixed
> 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
> Fix For: 1.15.0
>
>
> *+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)