Firestore network instability and silent write failures after upgrading Firebase BoM

未关闭
#7,953 3 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@MarkDuckworth 已经在做这个了。

开始于 2026年3月23日。

评估

这个 Issue 还没有评估数据。

描述

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?
主要语言
Java
星标
2.6k
派生
733
平均合并
2 天 15 小时
30 天内合并 PR
72

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

firebase/firebase-android-sdk 的其他 Issue

查看 firebase/firebase-android-sdk 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。