Skip to content

fix(android): Name the device-info caching thread#5684

Open
runningcode wants to merge 2 commits into
mainfrom
no/name-device-info-cache-thread
Open

fix(android): Name the device-info caching thread#5684
runningcode wants to merge 2 commits into
mainfrom
no/name-device-info-cache-thread

Conversation

@runningcode

Copy link
Copy Markdown
Contributor

📜 Description

DefaultAndroidEventProcessor pre-caches device info on a background thread using Executors.newSingleThreadExecutor() without a ThreadFactory. The JDK's default factory names such threads pool-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 ThreadFactory that names the (daemon) thread SentryDeviceInfoCache, matching the convention already used by HostnameCache, SentryExecutorService, and AsyncHttpTransport.

💡 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 DefaultAndroidEventProcessor unit tests continue to pass. The change only affects the name/daemon flag of the executor's thread, not its behavior.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • 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

runningcode and others added 2 commits July 2, 2026 18:45
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>
@runningcode runningcode marked this pull request as ready for review July 2, 2026 16:47
@sentry

sentry Bot commented Jul 2, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.47.0 (1) release

⚙️ sentry-android Build Distribution Settings

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.

1 participant