Skip to content

Provide an environment flag to disable error backtrace capturing. #812

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Nov 6, 2024

In performance-sensitive environments that throw many errors, the cost of capturing a backtrace for each one may be prohibitive. This PR allows disabling backtrace capture in environments where this is a problem.

Resolves #791.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

In performance-sensitive environments that throw many errors, the cost of
capturing a backtrace for each one may be prohibitive. This PR allows disabling
backtrace capture in environments where this is a problem.

Resolves #791.
@grynspan grynspan added enhancement New feature or request workaround Workaround for an issue in another component (may need to revert later) performance Performance issues issue-handling Related to Issue handling within the testing library labels Nov 6, 2024
@grynspan grynspan self-assigned this Nov 6, 2024
Copy link
Contributor

@stmontgomery stmontgomery left a comment

Choose a reason for hiding this comment

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

I think we should have a way to more granularly control whether the _CFErrorSetCallStackCaptureEnabled hook is enabled, independent of whether the broader Error backtrace capture feature is enabled.

@grynspan
Copy link
Contributor Author

grynspan commented Nov 6, 2024

@swift-ci test

@grynspan grynspan merged commit acf296d into main Nov 6, 2024
3 checks passed
@grynspan grynspan added this to the Swift 6.1 milestone Nov 6, 2024
@grynspan grynspan deleted the jgrynspan/791-disable-error-backtracing branch November 6, 2024 19:06
briancroom added a commit that referenced this pull request Nov 8, 2024
Follow-on from #812:

* Move the check slightly to ensure that it is applied in all scenarios.
* Disable the behavior by default due to it causing problems for some
tests which perform equality checks on NSError objects.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request issue-handling Related to Issue handling within the testing library performance Performance issues workaround Workaround for an issue in another component (may need to revert later)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable opting-out of thrown Error tracing
3 participants