Skip to content

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Jan 29, 2025

Issue

Closes #32898

Reason for this change

Today the log corking mechanism maintains both a global cork counter as well as a global log buffer. This is a problem for the Programmatic Toolkit as globally maintained memory can potentially lead to unexpected behavior especially in multithreaded workloads.

Description of changes

Moves all corked logging features inside the CliIoHost. Different instances will use independent corking, but that's okay since the CLI only ever uses a single instance. Adjusts tests accordingly.

Also reverts a change to promisify writing to the output stream. This was introduced in #32503 but causes notify to not be awaitable in same cases. The previous logging implementation never had that behavior and this is actually unnecessary.
https://github.com/aws/aws-cdk/pull/32503/files#diff-bc64c3cc9fa21a1c5af3389d57fd0aa0428343f2b0ea095748d9a457279797e6R85-R93

Describe any new or updated permissions being added

n/a

Description of how you validated changes

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@mrgrain mrgrain requested a review from a team as a code owner January 29, 2025 13:36
@github-actions github-actions bot added effort/medium Medium work item – several days of effort p2 labels Jan 29, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team January 29, 2025 13:36
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 29, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@aws aws deleted a comment from aws-cdk-automation Jan 29, 2025
@codecov
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.79%. Comparing base (9959a9e) to head (33e587a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #33226   +/-   ##
=======================================
  Coverage   80.78%   80.79%           
=======================================
  Files         232      232           
  Lines       14111    14106    -5     
  Branches     2453     2452    -1     
=======================================
- Hits        11400    11397    -3     
+ Misses       2431     2429    -2     
  Partials      280      280           
Flag Coverage Δ
suite.unit 80.79% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 79.53% <100.00%> (+0.01%) ⬆️
packages/aws-cdk-lib/core 82.17% <ø> (ø)

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 33e587a
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation
Copy link
Collaborator

➡️ PR build request submitted to test-main-pipeline ⬅️

A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.

@mrgrain mrgrain added the pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested label Jan 29, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review January 29, 2025 17:43

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 29, 2025
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

If I understand correctly, corked logging is mostly for instances when we are prompting the user and we don't want to pollute the stream with additional input until we collect our response. That will become something that anyone with two CliIoHost writing to the same stream has to manage on their own (since the CliIoHost cork independently of each other). But since the CLI only ever uses 1 CliIoHost, it won't be a problem for the aws-cdk CLI

@mergify
Copy link
Contributor

mergify bot commented Jan 29, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 6fa1d05 into main Jan 29, 2025
33 checks passed
@mergify mergify bot deleted the mrgrain/refactor/corked-logging branch January 29, 2025 19:33
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 29, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jan 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort p2 pr-linter/cli-integ-tested Assert that any CLI changes have been integ tested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeGlobalize log corking

3 participants