Skip to content

Round initialTime in RollingFileManager #3872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

kelunik
Copy link

@kelunik kelunik commented Aug 6, 2025

Caching of filesystem timestamps (at least in ext4 on Linux) results in non-accurate creation timestamps.

Thus, let's round it to the second.

Rounding is also applied for the lastModified time, but I'm not sure whether it's needed there.

Fixes #3068.

✅ Required checks

🧪 Tests (select one)

  • I have added or updated tests to cover my changes.
  • No additional tests are needed for this change.

📝 Changelog (select one)

  • I added a changelog entry in src/changelog/.2.x.x. (See Changelog Entry File Guide).
  • This is a trivial change and does not require a changelog entry.

Caching of filesystem timestamps (at least in ext4 on Linux) results in non-accurate creation timestamps.

Thus, let's round it to the second.

Rounding is also applied for the lastModified time, but I'm not sure whether it's needed there.

Fixes apache#3068.
@vy
Copy link
Member

vy commented Aug 9, 2025

While @ppkarwasz is the main figure stewarding #3068 and this one, I'd appreciate one or more new tests and a changelog entry.

@kelunik
Copy link
Author

kelunik commented Aug 9, 2025

@vy If you have an idea on how to test this properly, I'm happy to write a test.

Copy link

github-actions bot commented Aug 9, 2025

Job Requested goals Build Tool Version Build Outcome Build Scan®
build-macos-latest clean install 3.9.8 Build Scan PUBLISHED
build-ubuntu-latest clean install 3.9.8 Build Scan PUBLISHED
build-windows-latest clean install 3.9.8 Build Scan PUBLISHED
Generated by gradle/develocity-actions

@vy
Copy link
Member

vy commented Aug 9, 2025

If you have an idea on how to test this properly, I'm happy to write a test.

@kelunik, create a package-private initialFileTime(File,FileTime) that initialFileTime(File) delegates to, and write a unit test against initialFileTime(File,FileTime) verifying that the sub-second precision FileTime arguments are rounded as expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

Successfully merging this pull request may close these issues.

RollingFileAppender rotates files incorrectly on ext4 due to filesystem timestamp caching
3 participants