Skip to content

Conversation

@haroldrandom
Copy link
Contributor

@haroldrandom haroldrandom commented Apr 21, 2020

Description
This PR mainly did is to To make CLI instance close logger file after it's invoked, specifically:

  1. Fix the bug that would leak file handler and its corresponding fd (Fix Logging leaks file handles leading to FD exhaustion for long running scripts #12882, Fix Azure command logging is leaking file handles #10435)
  2. Fix the edge bug that file logger would write to previous file handler like test_feedback.py because of cli never clean up only when it exists.
  3. Bump knack to 0.7.0rc4 because need its new feature support

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 you lsof to 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.

@haroldrandom haroldrandom added bug This issue requires a change to an existing behavior in the product in order to be resolved. Test Framework Core CLI core infrastructure labels Apr 21, 2020
@haroldrandom haroldrandom self-assigned this Apr 21, 2020
@haroldrandom haroldrandom added this to the S169 - For Build milestone 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)
Copy link
Contributor Author

@haroldrandom haroldrandom Apr 21, 2020

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.

@yonzhan
Copy link
Collaborator

yonzhan commented Apr 21, 2020

add to S169

@haroldrandom
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@haroldrandom haroldrandom marked this pull request as ready for review April 22, 2020 04:26
Copy link
Member

@qianwens qianwens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue requires a change to an existing behavior in the product in order to be resolved. Core CLI core infrastructure Test Framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging leaks file handles leading to FD exhaustion for long running scripts Azure command logging is leaking file handles

4 participants