Skip to content
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

DeGlobalize log corking #32898

Closed
HBobertz opened this issue Jan 13, 2025 · 1 comment · Fixed by #33226
Closed

DeGlobalize log corking #32898

HBobertz opened this issue Jan 13, 2025 · 1 comment · Fixed by #33226
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort p2

Comments

@HBobertz
Copy link
Contributor

HBobertz commented Jan 13, 2025

Depends on #32816

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.

log corking logic needs to be moved into the IoHost class and specific to that IoHost instance

@HBobertz HBobertz changed the title DeGlobalize log corking De-globalize log corking Jan 13, 2025
@HBobertz HBobertz changed the title De-globalize log corking DeGlobalize log corking Jan 13, 2025
@khushail khushail added p2 effort/medium Medium work item – several days of effort @aws-cdk/core Related to core CDK functionality labels Jan 13, 2025
@mergify mergify bot closed this as completed in #33226 Jan 29, 2025
mergify bot pushed a commit that referenced this issue 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](https://github.com/aws/aws-cdk/blob/9604c62ebc9759e07abda426ec3bb644d8e58807/packages/aws-cdk/lib/logging.ts#L55) 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
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

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

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/core Related to core CDK functionality effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants