Skip to content
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

Flush buffer again after first "flush" event #447

Closed
wants to merge 1 commit into from
Closed

Flush buffer again after first "flush" event #447

wants to merge 1 commit into from

Conversation

compulim
Copy link
Contributor

In file transport, before the FileStream is opened, logs are buffered to _buffer.

Once the FileStream is opened, file transport will flush _buffer to disk and wait for the first drain event from the stream. After the drain event is received, _buffer will be decommissioned and subsequent write will direct to the FileStream itself.

There are race condition when the logs are written inbetween the flush call and the drain event. Logs written inbetween them will still be stored in _buffer (because self.opening is still true). Because we did not flush the _buffer again after drain, some logs could be orphaned there forever.

The fix is to flush the _buffer again after the drain event is received.

@compulim
Copy link
Contributor Author

Will include it in another pull request.

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.

1 participant