[Core] fix logging file fd leaking#13102
Merged
haroldrandom merged 6 commits intoAzure:devfrom Apr 22, 2020
Merged
Conversation
qianwens
reviewed
Apr 21, 2020
haroldrandom
commented
Apr 21, 2020
| result = execute(cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks) | ||
| # hotfix here for untouch feedback's code to avoid introducing possible break change. | ||
| # unregister the event for auto closing CLI's file logging after execute() is done | ||
| cli_ctx.unregister_event(EVENT_CLI_POST_EXECUTE, cli_ctx.logging.deinit_cmd_metadata_logging) |
Contributor
Author
There was a problem hiding this comment.
Have to unregister EVENT_CLI_POST_EXECUTE event to make cli instance not to clean up file logger handler. Such that to make this logger.error("There was an error during execution.") log to log file.
This is a hotfix. Otherwise, have to modify the code of feedback command.
But with the change, the content of the four log files change a little bit.
Collaborator
|
add to S169 |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Juliehzl
approved these changes
Apr 22, 2020
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.
Description
This PR mainly did is to To make CLI instance close logger file after it's invoked, specifically:
test_feedback.pybecause of cli never clean up only when it exists.The original discussion list here.
With the PR of knack which make knack be aware of SystemExit and the timing to raise EVENT_CLI_POST_EXECUTE is merged, the test should be fine.
Testing Guide
Follow the guide in the previous PR, it will show
(deleted)files when youlsofto inspect the opened files of CLI.With this fix, it won't show again.
History Notes
[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.