-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Fixing race issues in log rotator #1047
Conversation
@@ -88,12 +91,10 @@ func (f *FileRotator) Write(p []byte) (n int, err error) { | |||
if remainingSize < int64(len(p[n:])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should scan backwards through the buffer for a \n
and write/flush everything before that. Whatever comes after that last \n
should be moved to the beginning of the buffer and written out on the next write (as long as the line length is less than the buffer length, in which case you need to truncate). This only needs to happen on file rotation, not on write. I'll open an issue re: this in a sec.
Opening an issue for the remaining item, but LGTM otherwise. |
Just curious. Was the race in this just between the |
@a86c6f7964 correct! |
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixed #1042