Firestore network instability and silent write failures after upgrading Firebase BoM

Đang mở
#7,953 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@MarkDuckworth đang làm issue này rồi.

Từ ngày 23/3/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

api: firestore
Context

I'm using Firebase across Android and iOS:

  • Android & iOS via a fork of the GitLive Firebase Kotlin SDK
  • Some services (e.g. App Check) are used natively
  • All platforms use the same Firebase BoM version

Previously stable setup:

  • Firebase BoM: 33.2.0
  • No crashes, no network issues, no Sentry reports

Recent upgrades:

  • Kotlin → 2.3.20
  • AGP → 9.0.1
  • Firebase BoM → tested 33.15.0 and 34.9.0

Test environment:

  • Real Samsung device (fully updated, Android 15)
The issue

After upgrading, I started seeing frequent network-related errors:

1. SSL / NativeCrypto errors
2026-03-23 15:57:48.197 28596-28745 NativeCrypto            com.embedded_factory.typr.dev.debug  V  Read error: ssl=0xb40000760076b398: I/O error during system call, Software caused connection abort
2026-03-23 15:57:48.199 28596-28742 NativeCrypto            com.embedded_factory.typr.dev.debug  V  Write error: ssl=0xb40000760076b398: I/O error during system call, Broken pipe
2026-03-23 15:57:48.200 28596-28742 NativeCrypto            com.embedded_factory.typr.dev.debug  V  SSL shutdown failed: ssl=0xb40000760076b398: I/O error during system call, Success
2. gRPC resolution failures
2026-03-23 16:33:09.971 32172-6913  ManagedChannelImpl      com.embedded_factory.typr.dev.debug  W  [{0}] Failed to resolve name. status={1}
2026-03-23 16:33:11.706 32172-6913  ManagedChannelImpl      com.embedded_factory.typr.dev.debug  W  [{0}] Failed to resolve name. status={1}
2026-03-23 16:33:13.811 32172-6913  ManagedChannelImpl      com.embedded_factory.typr.dev.debug  W  [{0}] Failed to resolve name. status={1}
2026-03-23 16:33:17.598 32172-6913  ManagedChannelImpl      com.embedded_factory.typr.dev.debug  W  [{0}] Failed to resolve name. status={1}
2026-03-23 16:33:25.187 32172-6913  ManagedChannelImpl      com.embedded_factory.typr.dev.debug  W  [{0}] Failed to resolve name. status={1}
3. Sentry exceptions
javax.net.ssl.SSLException: Read error: ssl=0xb400007600771398: I/O error during system call, Software caused connection abort
    at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_read(:com.google.android.gms@[email protected] (260400-885717106))
    at com.google.android.gms.org.conscrypt.NativeSsl.read(:com.google.android.gms@[email protected] (260400-885717106):34)
    at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket$SSLInputStream.read(:com.google.android.gms@[email protected] (260400-885717106):61)
    at okio.internal.DefaultSocket$SocketSource.read(DefaultSocket.kt:124)
    at okio.RealBufferedSource.read(RealBufferedSource.kt:215)
    at okhttp3.internal.connection.Exchange$ResponseBodySource.read(Exchange.kt:346)
    at okio.RealBufferedSource.request(RealBufferedSource.kt:232)
    at okio.RealBufferedSource.require(RealBufferedSource.kt:225)
    at okio.RealBufferedSource.readByte(RealBufferedSource.kt:235)
    at okhttp3.internal.ws.WebSocketReader.readHeader(WebSocketReader.kt:125)
    at okhttp3.internal.ws.WebSocketReader.processNextFrame(WebSocketReader.kt:108)
    at okhttp3.internal.ws.RealWebSocket.loopReader(RealWebSocket.kt:317)
    at okhttp3.internal.ws.RealWebSocket$connect$1.onResponse(RealWebSocket.kt:204)
    at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:576)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1154)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:652)
    at java.lang.Thread.run(Thread.java:1564)
Additional Concern

With Firebase BoM 34.9.0, I started observing:

  • Firestore documents not being written
  • Silent failures (no clear exception surfaced)

This is new and did not happen on 33.2.0.

Attempted Mitigation

Given Android 15 background network restrictions:
https://developer.android.com/about/versions/15/behavior-changes-all#background-network-access

I implemented explicit Firestore network lifecycle handling:

object FirebaseNetworkLifecycle : DefaultLifecycleObserver {

    fun register() {
        ProcessLifecycleOwner.get().lifecycle.addObserver(this)
    }

    override fun onStart(owner: LifecycleOwner) {
        Napier.d("FirebaseNetworkLifecycle: enabling network")
        FirebaseFirestore.getInstance().enableNetwork()
    }

    override fun onStop(owner: LifecycleOwner) {
        Napier.d("FirebaseNetworkLifecycle: disabling network")
        FirebaseFirestore.getInstance().disableNetwork()
    }
}

Result: No real improvement

Observations

Errors often appear:

  • Shortly after app backgrounding, but also during normal foreground usage
    Looks like:
  • gRPC channel instability
  • WebSocket / streaming interruptions
  • Could be related to:
    • Android 15 network policy changes
    • gRPC / OkHttp upgrade inside Firebase BoM
    • TLS / Conscrypt behavior changes
Questions
  • Is this a known issue with recent Firebase BoM versions (33.15+ / 34.x)?

Any known incompatibility with:

  • Kotlin 2.3.x
  • AGP 9.x
  • Android 15 networking changes?

Has anything changed in:

  • Firestore streaming / WebSocket handling?
  • gRPC DNS resolution?
  • Are there recommended configurations or workarounds for Android 15?
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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của firebase/firebase-android-sdk

Tất cả issue của firebase/firebase-android-sdk

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.