DuplicateTaskCompletionException in Firestore ThrottledForwardingExecutor causes fatal crash
Maintainer thường phản hồi trong vòng 1 ngày
@wu-hui đang làm issue này rồi.
Từ ngày 8/4/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Description
We're seeing a fatal DuplicateTaskCompletionException crash originating from Firestore's internal ThrottledForwardingExecutor. The crash is a race condition where a TaskCompletionSource is resolved twice — entirely within SDK code, with no app code in the stack trace.
Environment
- Firebase BOM: 34.11.0
- firebase-firestore: 26.1.2
- play-services-tasks: 18.4.0
- Android versions affected: Multiple (seen on API 30+)
- Reproducibility: Intermittent — likely a threading race condition
Stack trace
Fatal Exception: com.google.android.gms.tasks.DuplicateTaskCompletionException: Complete with: result ip$a@22e602d
at com.google.android.gms.tasks.zzw.zzg(com.google.android.gms:play-services-tasks@@18.4.0:1)
at com.google.android.gms.tasks.zzw.zzc(com.google.android.gms:play-services-tasks@@18.4.0:2)
at com.google.android.gms.tasks.zzx.run(com.google.android.gms:play-services-tasks@@18.4.0:3)
at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0(ThrottledForwardingExecutor.java:54)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:923)
Analysis
The entire stack trace is inside SDK code — no app-level frames. ThrottledForwardingExecutor uses a semaphore to cap concurrency and falls back to running tasks synchronously on the calling thread when all slots are taken. This appears to create a window where two threads attempt to complete the same Task.
Suggested fix
Guard TaskCompletionSource.setResult() / setException() calls with trySetResult() / trySetException() in the code paths that run through ThrottledForwardingExecutor, or ensure the completion callback can only execute once.
Steps to reproduce
We have not been able to reproduce this on demand. It appears to be a timing-dependent race condition, possibly triggered by network transitions or app backgrounding during in-flight Firestore operations.
- Ngôn ngữ chính
- Java
- Star
- 2.6k
- Fork
- 733
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 72
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 firebase/firebase-android-sdk
-
api: remoteconfig
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
firebase/firebase-android-sdk#8827 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Crashlytics plugin writes build ID lists in directory listing order, so APKs can differ between machinesCó thể đã có người làm @mrober đã nhận 8 ngày trước. Đang mởapi: crashlytics
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
firebase/firebase-android-sdk#8789 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
api: auth
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
firebase/firebase-android-sdk#8505 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
firebase/firebase-android-sdk#8835 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
firebase/firebase-android-sdk#8832 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của firebase/firebase-android-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
NationalSecurityAgency/ghidra#10220 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 1 ngày
-
RIS export splits an organization name containing “and” into multiple authorsCó thể đã có người làm @Gautam-aman đã nhận hôm nay. Đang mởstatus: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
JabRef/jabref#17821 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FailureContext.java rounds down thresholds in lastedAtLeast()Có thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày