sergio-ropero opened a new pull request, #13464: URL: https://github.com/apache/kafka/pull/13464
In another project we are working on, we have faced an issue when trying to read the file at the same time it's being writen by a heavy process. This change is already applied in our repository, surpassing errors on corrupted file, but we think this change can be beneficial for other teams or projects. It's supper simple, just move out from the `try-catch` block everything that is not related with IO operations (type checks, in memory object loops, ...). That frees the resource and, if it got write before closing, we don't face a `java.io.StreamCorruptedException: unexpected EOF in middle of data block` exception. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org