Skip to content

fix: Log empty samples instead of collecting stacks for idle threads#2013

Merged
indragiek merged 10 commits into
masterfrom
indragiek/idle-thread-empty-sample
Jul 28, 2022
Merged

fix: Log empty samples instead of collecting stacks for idle threads#2013
indragiek merged 10 commits into
masterfrom
indragiek/idle-thread-empty-sample

Conversation

@indragiek

Copy link
Copy Markdown
Member

📜 Description

💡 Motivation and Context

Collecting stacks for idle threads produces this kind of data, where we have a stack that just shows the thread waiting on a function like mach_msg_trap. Instead of collecting these stacks, we can just log an empty sample, which will prevent it from rendering in the flamegraph.

CleanShot 2022-07-27 at 16 57 00@2x

This also fixes a bug in iOS 12 where we would repeatedly fail to suspend an idle thread, which broke some tests (#2000). With this new implementation we won't attempt to suspend an idle thread.

💚 How did you test it?

  • Run existing tests for SentrySamplingProfiler
  • Re-enable LaunchUITests and verify that they pass

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • Review from the native team if needed
  • No breaking changes

🔮 Next steps

@armcknight armcknight left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, got the old test back too 👍🏻

@indragiek
indragiek force-pushed the indragiek/idle-thread-empty-sample branch from 8ea353d to b06d08e Compare July 28, 2022 02:45
@indragiek

Copy link
Copy Markdown
Member Author

The failures in testStartTransaction_ProfilingDataIsValid are fixed in #2015 which I will merge before this change.

@indragiek
indragiek merged commit 78890ba into master Jul 28, 2022
@indragiek
indragiek deleted the indragiek/idle-thread-empty-sample branch July 28, 2022 17:18
kevinrenskers added a commit that referenced this pull request Aug 1, 2022
* master:
  ci: benchmarking and profile generation improvements (#2022)
  release: 7.23.0
  fix: Bad merge on CHANGELOG.md (#2020)
  fix: Log empty samples instead of collecting stacks for idle threads (#2013)
  fix: Handle failure to read thread priority gracefully (#2015)
  fix: Remove logging that could occur while a thread is suspended (#2014)
  fix: Use constant for max thread name size instead of magic number (#2012)
  Disable flaky tesDefaultMaxEnvelopesConcurrent (#2018)
  Fix build failure in unit tests (#2019)
  Fix address sanitizer compilation error (#1996)
  fix: Sauce labs iPhone 13 pro iOS version
  feat: Add transaction to baggage and trace headers (#1992)
  ci: fix ui thread starvation in benchmarks (#2009)
  fix: Add more descriptive deprecation message for enableProfiling (#2011)
  feat: Add sampling configuration for profiling (#2004)
  fix log message option name (#2006)
  meta: add armcknight as a codeowner (#2008)
  release: 7.22.0
  fix: Disable broken LaunchUITests to unblock release (#2003)

# Conflicts:
#	Samples/iOS-Swift/iOS-Swift/ViewControllers/PerformanceViewController.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants