fix(android): Name the device-info caching thread#5684
Open
runningcode wants to merge 2 commits into
Open
Conversation
DefaultAndroidEventProcessor created its device-info pre-caching executor via Executors.newSingleThreadExecutor() with no ThreadFactory, so the JDK named the thread pool-N-thread-M and it was not identifiable as an SDK thread. Supply a ThreadFactory that names it SentryDeviceInfoCache, matching the convention used elsewhere in the SDK. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
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.
📜 Description
DefaultAndroidEventProcessorpre-caches device info on a background thread usingExecutors.newSingleThreadExecutor()without aThreadFactory. The JDK's default factory names such threadspool-N-thread-M, which is not identifiable as a Sentry thread.This was the only thread-creation site in the SDK's production source that did not name its thread. This change supplies a
ThreadFactorythat names the (daemon) threadSentryDeviceInfoCache, matching the convention already used byHostnameCache,SentryExecutorService, andAsyncHttpTransport.💡 Motivation and Context
Named threads let customers identify which threads belong to the Sentry SDK when inspecting their apps (profilers, thread dumps, ANR traces). Every other thread the SDK spawns is already named; this closes the one remaining gap.
💚 How did you test it?
Existing
DefaultAndroidEventProcessorunit tests continue to pass. The change only affects the name/daemon flag of the executor's thread, not its behavior.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps