Same trigger instant may be calculated, resulting in loss of logs
Closed this issue · 4 comments
broafka-ottokar commented
The following line:
rounds the delay down to the nearest millis, causing the rotation to happen <1 ms too soon. After the rotation,
may calculate the same triggerInstant (because we are still ahead the previous one), causing filename duplication and overwritten files. These will happen on a properly fast machine.
Solution: add 1 ms to the delay or round up.
vy commented
@broafka-ottokar, thanks so much for the report. I will see what I can do about it.
In the meantime, curious: In which application do you use rotating-fos
? What is your use case?
vy commented
@broafka-ottokar, 19a033e fixes the issue in two angles:
- Switched to nanosecond resolution while scheduling the triggering task
- Ensuring
triggerInstant > lastTriggerInstant
Could you review the fix, please? If you are also okay, I will do a patch release.
broafka-ottokar commented
@vy Looks good to me.
In the meantime, curious: In which application do you use
rotating-fos
? What is your use case?
These are bespoke, non public apps, mostly web, some CLI. Basically the HTTP traffic log is rotated by this lib.
vy commented
@broafka-ottokar, released 0.9.7
. It should be available on Maven Central momentarily.