Destroyed AuthenticationActivity retained by CustomTabsController.authTabLauncher (4.1.0; unchanged in 5.0.0-beta.0)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- authentication, mobile
Hướng nghiên cứu
Start in CustomTabsController.java, specifically its authTabLauncher, TWA launcher and service-connection handling, and trace how AuthenticationActivity is referenced through ActivityResultRegistry. The issue has not been reproduced on a running build, so first reproduce the leak with LeakCanary on the 5.0.0-beta.0 sample or a consuming app. Done means the destroyed-activity chain no longer appears after sign-in and cancellation, and the existing controller tests still pass. Ask a maintainer to confirm the cleanup approach before you change it.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
CustomTabsController can retain a destroyed AuthenticationActivity through its authTabLauncher and activity result registry after browser authentication has ended and service unbinding has run.
Observed at runtime on Auth0.Android 4.1.0. Reporting for consideration in 5.0.0-beta.0 because its CustomTabsController.java is byte-identical to 4.1.0 (Git blob f8c484692ebcc0c4da307058244814a52bae2a64). We have not reproduced this on a running 5.0.0-beta.0 build.
Expected: destroyed authentication activities should become collectible after cleanup, even if native browser callbacks temporarily retain the service connection/controller.
Reproduction / observed workflow
Observed in an integrating Android application, not yet reduced to the official sample app. Exact minimal reproduction and frequency remain unconfirmed.
- Start hosted browser sign-in using
WebAuthProviderwith Chrome available. - Exercise browser cancellation and a subsequent sign-in, with portrait/landscape rotation in the native app and during browser authentication.
- Complete or cancel authentication, then background the app and inspect LeakCanary.
The baseline heap captured this chain after activity destruction:
GC root: global variable in native code
CustomTabsClient$3.this$0
-> CustomTabsServiceConnection$1.this$0
-> CustomTabsController.authTabLauncher
-> ActivityResultRegistry$register$2.this$0
-> ComponentActivity$activityResultRegistry$1.this$0
-> destroyed com.auth0.android.provider.AuthenticationActivity
Retained: 41,693 bytes / 603 objects
Retained duration: 505,682 ms
LeakCanary signature: e9b26f477f8329d40efcd1423486f13912bac553
The presence of authTabLauncher in the retained chain does not by itself mean the browser was launched in Auth Tab mode; the tested launch log reported the Custom Tabs path.
Proposed lifecycle cleanup and local verification
We tested a source-pinned 4.1.0 modification limited in production behavior to CustomTabsController:
- During the existing owner's destruction/unbind path, release the Auth Tab launcher, TWA launcher, session references, and weak context.
- Make teardown idempotent, balance service-binding attempts, and destroy the detached TWA launcher.
- Mark the controller closed and reject late service connections or queued browser launches after closure.
- Keep the existing activity lifecycle, callback recovery, PKCE, and token behavior intact. No reflection, forced browser termination, or suppression of leak detection.
After this modification, the same physical tablet passed browser-X cancellation, native rotation, browser rotation, and successful hosted sign-in returning to the native app. A fresh, user-requested LeakCanary heap analysis reported 0 application leaks, 0 library leaks, and 0 unreachable objects. The original one-leak report was retained in history.
Local automated verification: 25 controller tests plus 37 consuming-app authorization/setup tests passed; debug lint and APK assembly passed. This is bounded evidence, not a claim that every lifecycle path is leak-free.
Could maintainers confirm whether clearing these activity-owned references belongs in the controller's unbind/destruction cleanup and consider an upstream fix for this retention path?
Version comparison
- 5.0.0-beta.0 release PR #1081
- 4.1.0 to 5.0.0-beta.0 comparison
- The browser-provider change in that comparison only updates documentation links in
WebAuthProvider; the leaking controller is unchanged.
Environment
- Auth0.Android: 4.1.0 runtime reproduction; 5.0.0-beta.0 source comparison only.
- Android 14 / API 34, Samsung SM-T220 physical tablet.
- Browser: Chrome (exact browser version not captured in this report).
- LeakCanary 2.14.
No heap dump is attached because it may contain credentials or other sensitive application data. Open issues were searched for CustomTabsController and leak; no matching open issue was found. Official-sample reproduction and the remaining template checklist checks have not been completed.
- Ngôn ngữ chính
- Kotlin
- Star
- 301
- Fork
- 183
- Merge trung bình
- 1 ngày 3 giờ
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của auth0/Auth0.Android
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
auth0/Auth0.Android#1101 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của auth0/Auth0.Android
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
commons-app/apps-android-commons#7072 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ci good first issue help wanted severity: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dhananjay-nautiyal/music#17 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Watch Next: last engagement time is in seconds for played items and in milliseconds for the othersĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 79/100
damontecres/Wholphin#2112 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
beppe2880/opencode-mobile#60 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100