Merged
Conversation
3977a30 to
147065f
Compare
7c0a5ee to
9404aae
Compare
bitsandfoxes
commented
Apr 15, 2025
| # Build using older Linux version to preserve sdk compatibility with old GLIBC | ||
| # See discussion in https://github.com/getsentry/sentry-unity/issues/1730 for more details | ||
| host: ubuntu-20.04 | ||
| host: ubuntu-22.04 |
Contributor
Author
There was a problem hiding this comment.
This is a unrelated and temporary change to unblock CI in this PR.
bruno-garcia
approved these changes
Apr 15, 2025
Member
bruno-garcia
left a comment
There was a problem hiding this comment.
Does the device test cover any of this?
are sync'ing scope, and do we verify things got passed down?
| } | ||
| catch (Exception e) | ||
| { | ||
| // Adding the Sentry logger tag ensures we don't send this error to Sentry. |
Member
There was a problem hiding this comment.
do we send our own diagnostic logger stuff to Sentry? We shouldn't
Contributor
Author
Device tests make sure that the app does not crash and verifies the C# part of the SDK. To verify the sync itself we need #2099 |
This was referenced Nov 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem Statement
The issue manifested in two places:
JNI execution timed out.Analysis
After doing some naive and simple benchmarking, by logging 100 messages within one frame we get to
1.1707766sspent on that frame.When looking at the
ScopeObserverfor Android we - i.e.AddBreadcrumbsentry-unity/src/Sentry.Unity.Android/AndroidJavaScopeObserver.cs
Lines 23 to 25 in 16e21d8
see that we end up on the
JniExecutorsentry-unity/src/Sentry.Unity.Android/JniExecutor.cs
Line 128 in 16e21d8
that makes blocking calls into the JNI with a timeout
sentry-unity/src/Sentry.Unity.Android/JniExecutor.cs
Line 140 in 16e21d8
that easily gets hit
sentry-unity/src/Sentry.Unity.Android/JniExecutor.cs
Line 144 in 16e21d8
Considerations
maxBreadcrumblimit in the first place. So potentially blocking the game just to have them synched down a layer is incurring all the cost for limited benefit.AddBreadcrumbfor now. This happens under the assumption that any changes to the scope at runtime is triggered by the user and should end up on the native layer.Resolution
After running some benchmarks I realized that the whole worker-thread implementation is causing way more overhead than it was doing any good. Instead, the
JniExecutoris now merged intoSentryJavasince there was nothing left to du but handleattachinganddetachingto theAndroidJNI. This has to happen depending on whether we're running on the main-thread or not. Detaching from a still code executing thread will cause a crash.SentryJava. - Instead of having the scope observer call theJniExecutoron it's own.Benchmarks
Baseline = No sync to the Java SDK
Old = JNI worker thread synchronization
New = This PR
Follow Ups