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

feat(core): make creationStack collection for Lazy opt-in #11170

Merged
merged 4 commits into from
Oct 28, 2020

Conversation

RomainMuller
Copy link
Contributor

The collection of creation stack traces for each instanciation of a
Lazy object is fairly slow, and retention of the stack traces incurs a
significant toll on heap memory usage; especially in contexts where many
such instances are created.

In order to remove the performance toll of those and remove the impact
on heap allocation, while retaining the ability to get access to the
stack traces when they are useful (i.e: for debugging a resolution time
issue), the stack trace capture is now conditioned to the CDK_DEBUG
environment variable being set to 'true', which can also be set via
the new --debug argument of the cdk command line tool.

BREAKING CHANGE: Creation stack traces for Lazy values are no longer
captured by default. The CDK_DEBUG=true environment variable must be
set in order to capture stack traces (this is also achieved by using the
--debug option of the cdk CLI). Users should not need those stack
traces most of the time, and should only enable creation stack trace
captures when tyring to troubleshoot a resolution error that they are
otherwise unable to trace back.


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

The collection of creation stack traces for each instanciation of a
`Lazy` object is fairly slow, and retention of the stack traces incurs a
significant toll on heap memory usage; especially in contexts where many
such instances are created.

In order to remove the performance toll of those and remove the impact
on heap allocation, while retaining the ability to get access to the
stack traces when they are useful (i.e: for debugging a resolution time
issue), the stack trace capture is now conditioned to the `CDK_DEBUG`
environment variable being set to `'true'`, which can also be set via
the new `--debug` argument of the `cdk` command line tool.

BREAKING CHANGE: Creation stack traces for `Lazy` values are no longer
captured by default. The `CDK_DEBUG=true` environment variable must be
set in order to capture stack traces (this is also achieved by using the
`--debug` option of the `cdk` CLI). Users should not need those stack
traces most of the time, and should only enable creation stack trace
captures when tyring to troubleshoot a resolution error that they are
otherwise unable to trace back.
@RomainMuller RomainMuller added @aws-cdk/core Related to core CDK functionality package/tools Related to AWS CDK Tools or CLI contribution/core This is a PR that came from AWS. labels Oct 28, 2020
@RomainMuller RomainMuller self-assigned this Oct 28, 2020
@gitpod-io
Copy link

gitpod-io bot commented Oct 28, 2020

@RomainMuller RomainMuller added the pr-linter/exempt-readme The PR linter will not require README changes label Oct 28, 2020
packages/@aws-cdk/core/lib/lazy.ts Outdated Show resolved Hide resolved
@mergify
Copy link
Contributor

mergify bot commented Oct 28, 2020

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

@mergify
Copy link
Contributor

mergify bot commented Oct 28, 2020

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

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject6AEA49D1-qxepHUsryhcu
  • Commit ID: 46d1c18
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@mergify mergify bot merged commit a3fae02 into master Oct 28, 2020
@mergify mergify bot deleted the rmuller/lazy-stack-traces-opt-in branch October 28, 2020 16:12
rix0rrr added a commit that referenced this pull request Dec 21, 2020
Stack trace captured was intended to be disabled by default in #11170.

However, due to a logic error that didn't actually happen. This change
*actually* disables stack trace capture.

BREAKING CHANGE: Creation stack traces for `Lazy` values are no longer
captured by default in order to speed up tests. Run with
`CDK_DEBUG=true` (or `cdk --debug`) to capture stack traces.
mergify bot pushed a commit that referenced this pull request Dec 21, 2020
Stack trace captured was intended to be disabled by default in #11170.

However, due to a logic error that didn't actually happen. This change
*actually* disables stack trace capture.

The intent of the original change was to capture *Token* stack traces if
and only if `CDK_DEBUG=true` was set. *Metadata* and *Construct* stack
traces are managed in the `constructs` library, no longer in CDK.

BREAKING CHANGE: Creation stack traces for `Lazy` values are no longer
captured by default in order to speed up tests. Run with
`CDK_DEBUG=true` (or `cdk --debug`) to capture stack traces.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
flochaz pushed a commit to flochaz/aws-cdk that referenced this pull request Jan 5, 2021
Stack trace captured was intended to be disabled by default in aws#11170.

However, due to a logic error that didn't actually happen. This change
*actually* disables stack trace capture.

The intent of the original change was to capture *Token* stack traces if
and only if `CDK_DEBUG=true` was set. *Metadata* and *Construct* stack
traces are managed in the `constructs` library, no longer in CDK.

BREAKING CHANGE: Creation stack traces for `Lazy` values are no longer
captured by default in order to speed up tests. Run with
`CDK_DEBUG=true` (or `cdk --debug`) to capture stack traces.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/core Related to core CDK functionality contribution/core This is a PR that came from AWS. package/tools Related to AWS CDK Tools or CLI pr-linter/exempt-readme The PR linter will not require README changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants