spring-projects / spring-projects/spring-batch

StepExecutionContext gets updated on transaction rollback

Open
#1,145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has: minimal-example in: core related-to: transaction-management status: waiting-for-triage type: bug
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Daniel Stuckert opened BATCH-2457 and commented

When an exception is thrown in a chunked step and the execution context has been updated while processing items the execution context gets updated. This causes a problem when information about the processed items has been stored in the context. The business transaction has been rolled back and the items have not been committed to the database, but the execution context does not reflect the rollback.

The expectation is that the execution context gets rolled back.

To reproduce the problem run the attached test

The read and write-count have a similar problem. They get updated as well when the transaction is rolled back.


Affects: 3.0.5

Attachments:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the attached batch-execution-context-test.zip test to reproduce the rollback behavior. Check how the execution context, read-count, and write-count change when a chunk transaction fails; done means they reflect the rollback and no longer retain updates for uncommitted items.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.