fix(NLog): Correct task tracking to prevent dropped logs on shutdown#15561
Open
robertvoinescu-work wants to merge 1 commit intogoogleapis:mainfrom
Open
fix(NLog): Correct task tracking to prevent dropped logs on shutdown#15561robertvoinescu-work wants to merge 1 commit intogoogleapis:mainfrom
robertvoinescu-work wants to merge 1 commit intogoogleapis:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where log entries could be dropped during shutdown because the Flush method did not correctly await all pending asynchronous uploads. The fix involves adding .Unwrap() to the task chaining logic in GoogleStackdriverTarget.cs, ensuring that _prevTask tracks the actual completion of the gRPC upload rather than just the initiation of the task. Additionally, a new unit test Flush_AwaitsAllTasks has been added to verify that Flush properly waits for chained uploads. I have no feedback to provide as the changes are correct and well-tested.
144d6ad to
95da5b3
Compare
95da5b3 to
b01fc85
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an issue where
WriteLogEntriestasks were tracked incorrectly due to mixing.ContinueWithwithasync/await. This premature completion caused logs to be dropped during application shutdown. See inline comments for details.Validation
Before fix: The second message is dropped because the task is killed.

After fix: Both messages upload successfully.

b/450286403