Visitar URL original
Fix Tailer rotation retry after replacement open failure by hang4309 · Pull Request #878 · apache/commons-io · GitHub
Skip to content

Fix Tailer rotation retry after replacement open failure - #878

Draft
hang4309 wants to merge 1 commit into
apache:masterfrom
hang4309:fix-tailer-rotation-retry
Draft

hang4309 wants to merge 1 commit into
apache:masterfrom
hang4309:fix-tailer-rotation-retry

Conversation

@hang4309

@hang4309 hang4309 commented Sep 8, 2026

Copy link
Copy Markdown

Follows up on the reported failed reopen during rotation.

If opening the replacement throws FileNotFoundException, the existing try-with-resources closes the old reader. Subsequent reads may then terminate the tailer. Keeping that reader open alone is insufficient when the replacement grows past the previous position before the next poll.

This patch opens the replacement before closing the old reader and retains rotationPending until reopening succeeds. Remaining old-file lines are read after the replacement opens. It does not fix the separate periodic reOpen failure path described in IO-399.

Validation on base f720b24227eb6972d4281d330ddb64c1416f81a4:

  • Four deterministic rotation cases cover zero, one, and two failed opens, plus stopping during retry. Three fail on the unmodified base; all four pass with the patch.
  • Targeted Tailer run: 32 tests, zero failures/errors, one existing Windows skip.
  • Checkstyle, PMD, and SpotBugs checks pass.
  • The full default build did not complete successfully on Windows. Three PathUtilsCopyTest symlink privilege errors reproduce on the unmodified base. This is not a claim that the full test suite passes.

Submitted following the maintainer's suggestion to provide a PR with a failing test. A Jira association can be added as needed.

@garydgregory

Copy link
Copy Markdown
Member

@hang4309
Please rebase git master and fix your build. Could the current failure be a random failure?

@garydgregory
garydgregory marked this pull request as draft October 25, 2026 22:21
@garydgregory

Copy link
Copy Markdown
Member

@hang4309 Ping 🔔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants