You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ExecutionContext dirty flag is never cleared #5249
Bug description
The dirty flag of ExecutionContext is never cleared because org.springframework.batch.infrastructure.item.ExecutionContext#clearDirtyFlag() is never called.
Environment
Spring Batch version 6.0.2
Java version: 17.0.1
Database: H2 2.4.240
Steps to reproduce
Dirty a job or step execution context by calling one of the put* methods
Call JobRepository#updateExecutionContext
Call ExecutionContext#isDirty()
Expected behavior
I would expect org.springframework.batch.core.repository.JobRepository#updateExecutionContext(StepExecution) and org.springframework.batch.core.repository.JobRepository#updateExecutionContext(JobExecution) to clear the dirty flag.
Minimal Complete Reproducible example
Add to org.springframework.batch.core.repository.support.AbstractJobRepositoryIntegrationTests
Is that indeed the indented behaviour that the repositories clear the context dirty flag after updating?
Yes, every time the execution context is synchronized with the database, it should be considered fresh again (ie no updates happened since the last commit) and therefore I also expect the "dirty" flag to be cleared on updates.
Activity
quaff commentedon Feb 2, 2026
Indeed,
context.clearDirtyFlag()in called only inExecutionContextTests, you should submit an PR instead.Fix dirty flag not cleared in updateExecutionContext
marschall commentedon Feb 2, 2026
I see there is already a PR. Is that indeed the indented behaviour that the repositories clear the context dirty flag after updating?
Fix dirty flag not cleared in updateExecutionContext
fmbenhassine commentedon May 29, 2026
Yes, every time the execution context is synchronized with the database, it should be considered fresh again (ie no updates happened since the last commit) and therefore I also expect the "dirty" flag to be cleared on updates.
Clear dirty flag on ExecutionContext updates
Clear dirty flag on ExecutionContext updates