Firestore network instability and silent write failures after upgrading Firebase BoM

Aperta
#7,953 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@MarkDuckworth ci sta già lavorando.

Dal 23/3/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

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?
Lingua principale
Java
Stelle
2.6k
Fork
733
Merge medio
2g 15h
PR unite (30g)
72

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di firebase/firebase-android-sdk

Tutte le issue di firebase/firebase-android-sdk

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.