-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Core] fix logging file fd leaking #13102
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
Conversation
| 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) |
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.
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.
|
add to S169 |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
qianwens
left a comment
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.
![]()
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.