Skip to content

Conversation

stefanosiano
Copy link
Member

📜 Description

Removed lock from AndroidTransactionProfiler

💡 Motivation and Context

Trying to reduce ANRs. There are reports of ANRs happening when getting the lock on transaction start/end

resolves #4792

💚 How did you test it?

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

@stefanosiano stefanosiano marked this pull request as ready for review October 20, 2025 11:32
cursor[bot]

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 329.80 ms 401.20 ms 71.41 ms
Size 1.58 MiB 2.12 MiB 548.08 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
85d7417 347.21 ms 394.35 ms 47.15 ms
d364ace 411.72 ms 430.81 ms 19.10 ms
ee747ae 396.82 ms 441.67 ms 44.86 ms
bdbe1f4 380.66 ms 464.44 ms 83.78 ms
c8125f3 383.82 ms 441.66 ms 57.84 ms
ee747ae 386.94 ms 431.43 ms 44.49 ms
806307f 357.85 ms 424.64 ms 66.79 ms
ee747ae 554.98 ms 611.50 ms 56.52 ms
b3d8889 371.69 ms 432.96 ms 61.26 ms
7314dbe 437.83 ms 505.64 ms 67.81 ms

App size

Revision Plain With Sentry Diff
85d7417 1.58 MiB 2.10 MiB 533.44 KiB
d364ace 1.58 MiB 2.11 MiB 539.75 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
bdbe1f4 1.58 MiB 2.11 MiB 538.88 KiB
c8125f3 1.58 MiB 2.10 MiB 532.32 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
806307f 1.58 MiB 2.10 MiB 533.42 KiB
ee747ae 1.58 MiB 2.10 MiB 530.95 KiB
b3d8889 1.58 MiB 2.10 MiB 535.06 KiB
7314dbe 1.58 MiB 2.10 MiB 533.45 KiB

Previous results on branch: stefanosiano/enh/remove-profiling-lock

Startup times

Revision Plain With Sentry Diff
6329f7d 302.88 ms 357.80 ms 54.92 ms

App size

Revision Plain With Sentry Diff
6329f7d 1.58 MiB 2.11 MiB 539.66 KiB

}
}

boolean isRunning() {
Copy link
Member

Choose a reason for hiding this comment

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

haven't looked at the entire PR yet, but feels like this should be AtomicBoolean?

Copy link
Member Author

Choose a reason for hiding this comment

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

don't think it's necessary
it's accessed by AndroidTransactionProfiler only in the block guarded by its own AtomicBoolean isRunning

@stefanosiano stefanosiano changed the title [ANR] Removed AndroidTransactionProfiler lock [ANR] Reduced AndroidTransactionProfiler lock Oct 21, 2025
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.

io.sentry.android.core.ApplicationNotResponding: Background ANR

2 participants