mirror of
https://github.com/ushahidi/SMSSync.git
synced 2026-04-26 00:05:57 +03:00
[GH-ISSUE #377] Log file rotation looks dangerous #272
Labels
No labels
Bug report
Code improvement
Concern
Feature request
Feature request
Good first issue to work on
In progress
Needs info
Question
Ready
Translation
User Experience
User Experience
Website
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SMSSync#272
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @alxndrsn on GitHub (Apr 6, 2016).
Original GitHub issue: https://github.com/ushahidi/SMSSync/issues/377
Observed
FileManager.rotate()looks like it will have unpredictable results:The “rotation” occurs, on a separate thread, as follows:
The
PrintWriterfor writinglogFileis created on the original thread, so it may or may not be created before the rotation is completed. It is opened in append mode, and it’s not immediately clear which file this will write to (new or old), and if theWriterwill point to a deleted file if the execution order is as follows:PrintWritercreated, pointing tosmssync_logsmssync_log.newcreated, and moved tosmssync_logBecause the rotation is happening on a separate thread, there may be concurrent writes to
smssync_logwhile it is also being read and rewritten to thesmssync_log.newfile.Suggested fixes
One of the following might improve things:
Notes
Due to https://github.com/ushahidi/SMSSync/issues/375, the
rotate()method will currently never be called.