Skip to content

SynchronizeStatus in MongoJobExecutionDao is not upgrading the status of the JobExecution #4760

Closed
@denis-yablonsky

Description

@denis-yablonsky

Bug description
Unlike the JdbcJobExecutionDao, the MongoJobExecutionDao is not "upgrading" the status of the jobExecution that was passed in. This can cause behavior where a job status can go from STOPPING back to STARTED by an asynchronous update.

Environment
Spring Batch version: 5.2.1
Java version:17.0.8
which database you use: Mongo 8.0.1

Steps to reproduce
Steps to reproduce the issue:

  1. Start a Job using JobLauncher
  2. Attempt to stop the job using JobOperator::stop
  3. Verify the status in the jobExecution is updated to STOPPING via the JobExplorer
  4. Wait for end of step to update JobExecution
  5. Verify the status in the jobExecution is downgraded to STARTED via the JobExplorer

Expected behavior
I would expect the status to not be allowed to downgrade because that is the behavior of the JDBC implementation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions