Android: a cached envelope is deleted when its resend outlasts flushTimeoutMillis, so a slow or hung connection loses the crash report
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
調査の方向性
Start with EnvelopeSender.java around the processFile logic cited in the issue, then compare its waitFlush() behavior with the 4000 ms setting in AndroidOptionsInitializer. Trace how a send failure marks an envelope for retry and how the crash handler waits for storage. Done means a slow or hung send does not cause the cached crash report to be lost; the reproduction steps provide a way to verify this.
索引モデルが issue の本文から書いたものです。
説明
Description
On Android, a cached envelope (for example, a crash stored on the previous launch) is deleted before its resend has finished, when that resend takes longer than flushTimeoutMillis. The envelope is then never sent.
EnvelopeSender.processFile captures the cached envelope and waits flushable.waitFlush(), which is flushTimeoutMillis: 4000 ms on Android, set in AndroidOptionsInitializer (see #2732). It then deletes the file unless the transport has already marked the envelope for retry (EnvelopeSender.java, around L91–98). The transport marks retry only when the send fails with an IOException. With the default connectionTimeoutMillis and readTimeoutMillis of 30 000 ms, a hung connection fails at about 30 s.
So any resend that takes more than about 4 s loses the race. The file is deleted at about 4 s, and when the IOException arrives the in-memory envelope is not stored again.
There is a related case with the same cause. A Java crash captured while an earlier send is hung on the transport's single thread is never written to disk, because the crash handler waits only flushTimeoutMillis for it to be stored.
Steps to reproduce
- Use an Android app on sentry-android 8.31.0. We reproduced it with a plain
@sentry/react-native7.11.0 setup, where the native SDK is initialised once, from JS. The code path is the same on 8.58.0 /main. - Crash the app (
adb shell am crash <package>), so the event is cached. - Before relaunching, make the ingest host unreachable without losing connectivity. On an emulator:
adb root, thenadb shell iptables -I OUTPUT -d <ingest-ip> -j DROP. - Launch and wait at least 5 s. About 4 s after init, the cached envelope disappears from
cache/sentry/<hash>/. - Remove the rule and relaunch. The crash never arrives in Sentry.
With the network open, the same crash arrives. On a Pixel 6 emulator (API 35), every blocked run lost the report and every open run delivered it.
Expected result
A cached envelope whose send has not completed is kept for a later retry instead of being deleted when the flush wait expires. Alternatively, the flush wait for cached sends and the connection/read timeouts are reconciled, so a failed send is marked retryable before the file can be deleted.
Actual result
The crash report is lost.
Versions
sentry-android 8.31.0 (via @sentry/react-native 7.11.0); source checked on 8.58.0.
- 主要言語
- Kotlin
- スター
- 1.4k
- フォーク
- 483
- 平均マージ
- 2日 2時間
- マージ済み PR(30日)
- 202
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-java のほかの issue
-
Test the `sentry wizard` Android port対応中かも @antonis が 1 日前に担当しました。 オープンPlatform: Java
getsentry/sentry-java#6797 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Narrow and clean up Android consumer keep rules対応中かも @runningcode が 3 日前に担当しました。 オープンAndroid Platform: Java
getsentry/sentry-java#6771 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Android Bug Platform: Java Waiting for: Product Owner
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
getsentry/sentry-java#6758 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
Android Bug Platform: Java Replays
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
getsentry/sentry-java#6741 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Android Bug Platform: Java Replays
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
getsentry/sentry-java#6740 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
getsentry/sentry-java の issue をすべて見る
似ている issue
-
device-support good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
Legacy Chat backups screen overlaps status and navigation bars対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
signalapp/Signal-Android#15150 ·
メンテナーはふだん 1 日以内に返信
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 91/100
simplex-chat/simplex-chat#8372 ·
メンテナーはふだん 1 日以内に返信
-
android:core
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
championswimmer/TwoFac#178 ·
メンテナーはふだん 1 日以内に返信