spring-projects / spring-projects/spring-batch
lineNumber in FlatFileItemReader not threadsafe
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3k
- Forks
- 2.5k
- Avg merge
- 6d 53m
- Merged PRs (30d)
- 3
Description
If multiple threads are configured in a step using a FlatFileItemReader, the lineNumber issued to the linemapper is compromised.
As a simple possible solution, the readline-Method must be synchronized. The lineMapper itself does not need sync.
BTW: In doc of the ItemReader the statement
" Implementations need not be thread-safe and clients of a {@link ItemReader}
need to be aware that this is the case.
"
is deeply misleading.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with FlatFileItemReader and its readline method, then review the ItemReader documentation quoted in the issue. Reproduce a multi-threaded step using the reader and inspect how lineNumber reaches the lineMapper. Done means concurrent reads provide correct line numbers without requiring synchronization in the lineMapper.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100