You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-09-30] [Sentry: APP-JZ] Android OldDot crash — RxJava UndeliverableException from reactivelocation2 GoogleAPIConnectionSuspendedException #99852
Culprit: io.reactivex.plugins.RxJavaPlugins in onError
Error
UndeliverableException: The exception could not be delivered to the consumer because it has already
canceled/disposed the flow or the exception has nowhere to go to begin with.
| pl.charmas.android.reactivelocation2.observables.GoogleAPIConnectionSuspendedException
Play Services suspends the location API connection after the RxJava observable has already been
disposed. reactivelocation2 calls onError on a dead emitter, RxJava has nowhere to deliver it, so
it wraps the cause in UndeliverableException and rethrows it as fatal through the global UncaughtExceptionHandler on the main looper. The app dies.
Event context shows in_foreground: false, so this kills the app while it sits in the background,
which the user then experiences as a silent restart.
Two things to fix:
Install a global RxJavaPlugins.setErrorHandler that logs and swallows UndeliverableException
instead of letting it reach the default handler. This is the standard remedy the RxJava wiki link
in the message itself recommends.
Dispose the location subscription when the hosting component stops, so a suspended connection has
no dead emitter to signal in the first place.
Reproduction
Unknown — see the events linked from the Sentry issue. Losing Play Services connectivity while a
location observable is active and the app is backgrounded is the trigger. Affected devices are recent
and high end (Samsung SM-S948U on Android 16), so this is not a low-end device problem.
This crash cannot be fixed in Expensify/App. The faulting code ships from Expensify/Mobile-Expensify (OldDot Android). App contains zero RxJava and zero ReactiveLocation — verified across all 144 Gradle files plus a full-tree grep for RxJavaPlugins, including node_modules. App's only location stack is expo-location → play-services-location:21.0.1 (FusedLocationProviderClient), which has no reactive layer. In HybridApp builds the Android sourceDir is the submodule, not android/ (rock.config.mjs:22). This needs an internal engineer with Mobile-Expensify access.
Root cause: the ReactiveLocation library treats a temporary Play Services suspension as a terminal Rx error. onConnectionSuspended calls emitter.onError(GoogleAPIConnectionSuspendedException); the subscriber is already disposed (app backgrounded), so RxJava wraps it in UndeliverableException, finds no global error handler, and hands it to the thread's UncaughtExceptionHandler → process death.
Three things worth adding to the plan in the description
1. The :105 frame says you're on library version 2.0, not 2.1. In 2.1, line 105 is an isDisposed() guard and line 106 is the throw. In 2.0 line 105 is the unguarded emitter.onError. Check the resolved dependency version first (R8 line mapping can shift frames, so confirm against Gradle, not the trace alone).
2. There is a one-line upstream fix the description misses.ReactiveLocationProviderConfiguration.setRetryOnConnectionSuspended(true) — added in 2.1 by PR #165 to close #154, defaults to false, and is absent from the README. It composes a .retry() on GoogleAPIConnectionSuspendedException so the stream resubscribes instead of dying. This fixes the root cause; the RxJavaPlugins.setErrorHandler in the description only suppresses the symptom.
3. Suggestion 2 in the description ("dispose on stop") won't work alone — it is what creates the race.onConnectionSuspended arrives on the main looper while onStop() disposes on another thread. Even 2.1's guard is a non-atomic check-then-act, so disposal can land between the check and the emit. On 2.0 the guard doesn't exist at all.
Recommended order: upgrade 2.0 → 2.1 and set setRetryOnConnectionSuspended(true), then add a filteringRxJavaPlugins.setErrorHandler (unwrap UndeliverableException, swallow only GoogleAPIConnectionSuspendedException, rethrow everything else) as a safety net. A blanket no-op handler would silently eat every undeliverable error process-wide, including NewDot's.
Longer term, the library has been dead since 2017-12-20 (last commit, last Maven artifact, 27 open issues) and still uses the deprecated GoogleApiClient and pre-AndroidX android.support annotations. FusedLocationProviderClient has no ConnectionCallbacks at all, so migrating deletes this failure mode entirely. NewDot already runs a modern Fused stack in the same process.
Supporting evidence
Why the exception becomes fatal
BaseObservableOnSubscribe wraps everything in Observable.create(...) and never calls emitter.serialize(), so the emitter is ObservableCreate.CreateEmitter.
ObservableCreate.java:70-91 — tryOnError returns false when disposed, falling through to RxJavaPlugins.onError(t) at line 73. That matches the reported frame exactly.
RxJavaPlugins.isBug() passes through only a fixed set (NullPointerException, IllegalStateException, …). GoogleAPIConnectionSuspendedException extends RuntimeException, so it gets wrapped in UndeliverableException.
With errorHandler == null, uncaught() calls the thread's UncaughtExceptionHandler. The RxJava 2 wiki states this directly: "Android is more strict and terminates the application in such uncaught exception cases."
Why it skews to background (in_foreground: false)
GoogleApiClient holds a bound-service connection to the Play Services process. CAUSE_SERVICE_DISCONNECTED = 1 means that process was killed — LMK pressure, a Play Services self-update, or the system reclaiming the binding. Android 14 cached-process enforcement makes both halves more likely at once: the app is more likely to be cached/reclaimed, and it is simultaneously disposing subscriptions in onStop(). I found no Android 15/16 change that specifically raises suspension frequency, so treat the "recent Android version" framing as unconfirmed — the API 34 change is the documented driver. An API-level histogram on the Sentry events would settle it.
Note that GoogleAPIConnectionSuspendedException carries no message and only exposes getErrorCause(), so the crash reports won't show whether the cause was CAUSE_SERVICE_DISCONNECTED (1) or CAUSE_NETWORK_LOST (2).
Prior art — this exact trace, already reported upstream
#175 (closed) — byte-for-byte the same stack at BaseObservableOnSubscribe.java:105. Maintainer: "Should be fixed in 2.1." That claim is overstated; 2.1 only narrows the race.
#171, #169, #123 — same pattern, other subscribers / RxJava 1.
#173, #177, #179 — still open: migrate off GoogleApiClient, FusedLocationProviderApi deprecated, Oreo background limits.
#198 — "is this library still maintained?", open since 2018, unanswered by the author.
Why an OldDot crash lands in an App Sentry project
The Sentry Android SDK installs a process-wideUncaughtExceptionHandler, so a fatal thrown on an OldDot RxJava thread inside org.me.mobiexpensifyg reports into APP-JZ regardless of which repo shipped the code. Events are tagged build_type=hybrid at src/setup/telemetry/setupSentry.ts:88. Sentry attribution here is not evidence of App ownership. If any APP-JZ event shows build_type=standalone, that would contradict this analysis and is worth re-checking.
Alternatives considered and ruled out
A NewDot/expo-location regression — ruled out: expo-location uses FusedLocationProviderClient, which has no ConnectionCallbacks and cannot produce this frame. App's own GpsTripService.kt only posts a foreground-service notification and calls no location API.
A transitive RxJava pull-in on the App side — ruled out by the exhaustive Gradle scan above.
An existing error handler misbehaving — ruled out for App (zero RxJavaPlugins occurrences). Unverified for Mobile-Expensify; if one is already installed there, these crashes are arriving via a different path and the analysis needs revisiting.
Confidence: medium-high. The mechanism is confirmed against upstream library and RxJava source. Not verified (needs Mobile-Expensify access): the pinned library version, whether setRetryOnConnectionSuspended is already set, and whether any error handler is already installed.
Related issues: only the parent tracker #91302, already linked. No duplicates found.
Next Steps: This needs an internal engineer with Expensify/Mobile-Expensify access — I can't open a PR against it. Reply with @MelvinBot <your feedback> to refine this analysis.
Heads up: the fix for this crash lives in Expensify/Mobile-Expensify (OldDot Android), not this repo — see the analysis above for the recommended order of changes.
Activity
Julesssss commentedon Aug 31, 2026
@MelvinBot investigate this
MelvinBot commentedon Aug 31, 2026
Issue Analysis
This crash cannot be fixed in
Expensify/App. The faulting code ships fromExpensify/Mobile-Expensify(OldDot Android). App contains zero RxJava and zero ReactiveLocation — verified across all 144 Gradle files plus a full-tree grep forRxJavaPlugins, includingnode_modules. App's only location stack isexpo-location→play-services-location:21.0.1(FusedLocationProviderClient), which has no reactive layer. In HybridApp builds the Android sourceDir is the submodule, notandroid/(rock.config.mjs:22). This needs an internal engineer with Mobile-Expensify access.Root cause: the ReactiveLocation library treats a temporary Play Services suspension as a terminal Rx error.
onConnectionSuspendedcallsemitter.onError(GoogleAPIConnectionSuspendedException); the subscriber is already disposed (app backgrounded), so RxJava wraps it inUndeliverableException, finds no global error handler, and hands it to the thread'sUncaughtExceptionHandler→ process death.Three things worth adding to the plan in the description
1. The
:105frame says you're on library version 2.0, not 2.1. In 2.1, line 105 is anisDisposed()guard and line 106 is the throw. In 2.0 line 105 is the unguardedemitter.onError. Check the resolved dependency version first (R8 line mapping can shift frames, so confirm against Gradle, not the trace alone).2. There is a one-line upstream fix the description misses.
ReactiveLocationProviderConfiguration.setRetryOnConnectionSuspended(true)— added in 2.1 by PR #165 to close #154, defaults tofalse, and is absent from the README. It composes a.retry()onGoogleAPIConnectionSuspendedExceptionso the stream resubscribes instead of dying. This fixes the root cause; theRxJavaPlugins.setErrorHandlerin the description only suppresses the symptom.3. Suggestion 2 in the description ("dispose on stop") won't work alone — it is what creates the race.
onConnectionSuspendedarrives on the main looper whileonStop()disposes on another thread. Even 2.1's guard is a non-atomic check-then-act, so disposal can land between the check and the emit. On 2.0 the guard doesn't exist at all.Recommended order: upgrade 2.0 → 2.1 and set
setRetryOnConnectionSuspended(true), then add a filteringRxJavaPlugins.setErrorHandler(unwrapUndeliverableException, swallow onlyGoogleAPIConnectionSuspendedException, rethrow everything else) as a safety net. A blanket no-op handler would silently eat every undeliverable error process-wide, including NewDot's.Longer term, the library has been dead since 2017-12-20 (last commit, last Maven artifact, 27 open issues) and still uses the deprecated
GoogleApiClientand pre-AndroidXandroid.supportannotations.FusedLocationProviderClienthas noConnectionCallbacksat all, so migrating deletes this failure mode entirely. NewDot already runs a modern Fused stack in the same process.Supporting evidence
Why the exception becomes fatal
BaseObservableOnSubscribewraps everything inObservable.create(...)and never callsemitter.serialize(), so the emitter isObservableCreate.CreateEmitter.ObservableCreate.java:70-91—tryOnErrorreturnsfalsewhen disposed, falling through toRxJavaPlugins.onError(t)at line 73. That matches the reported frame exactly.RxJavaPlugins.isBug()passes through only a fixed set (NullPointerException,IllegalStateException, …).GoogleAPIConnectionSuspendedException extends RuntimeException, so it gets wrapped inUndeliverableException.errorHandler == null,uncaught()calls the thread'sUncaughtExceptionHandler. The RxJava 2 wiki states this directly: "Android is more strict and terminates the application in such uncaught exception cases."Why it skews to background (
in_foreground: false)GoogleApiClientholds a bound-service connection to the Play Services process.CAUSE_SERVICE_DISCONNECTED = 1means that process was killed — LMK pressure, a Play Services self-update, or the system reclaiming the binding. Android 14 cached-process enforcement makes both halves more likely at once: the app is more likely to be cached/reclaimed, and it is simultaneously disposing subscriptions inonStop(). I found no Android 15/16 change that specifically raises suspension frequency, so treat the "recent Android version" framing as unconfirmed — the API 34 change is the documented driver. An API-level histogram on the Sentry events would settle it.Note that
GoogleAPIConnectionSuspendedExceptioncarries no message and only exposesgetErrorCause(), so the crash reports won't show whether the cause wasCAUSE_SERVICE_DISCONNECTED(1) orCAUSE_NETWORK_LOST(2).Prior art — this exact trace, already reported upstream
BaseObservableOnSubscribe.java:105. Maintainer: "Should be fixed in 2.1." That claim is overstated; 2.1 only narrows the race.GoogleApiClient,FusedLocationProviderApideprecated, Oreo background limits.Why an OldDot crash lands in an App Sentry project
The Sentry Android SDK installs a process-wide
UncaughtExceptionHandler, so a fatal thrown on an OldDot RxJava thread insideorg.me.mobiexpensifygreports into APP-JZ regardless of which repo shipped the code. Events are taggedbuild_type=hybridatsrc/setup/telemetry/setupSentry.ts:88. Sentry attribution here is not evidence of App ownership. If any APP-JZ event showsbuild_type=standalone, that would contradict this analysis and is worth re-checking.Alternatives considered and ruled out
FusedLocationProviderClient, which has noConnectionCallbacksand cannot produce this frame. App's ownGpsTripService.ktonly posts a foreground-service notification and calls no location API.RxJavaPluginsoccurrences). Unverified for Mobile-Expensify; if one is already installed there, these crashes are arriving via a different path and the analysis needs revisiting.Confidence: medium-high. The mechanism is confirmed against upstream library and RxJava source. Not verified (needs Mobile-Expensify access): the pinned library version, whether
setRetryOnConnectionSuspendedis already set, and whether any error handler is already installed.Related issues: only the parent tracker #91302, already linked. No duplicates found.
Next Steps: This needs an internal engineer with
Expensify/Mobile-Expensifyaccess — I can't open a PR against it. Reply with@MelvinBot <your feedback>to refine this analysis.view run
GCyganek commentedon Sep 1, 2026
@MelvinBot assign me
MelvinBot commentedon Sep 1, 2026
🤖 Assigned
GCyganekto this issue.Heads up: the fix for this crash lives in
Expensify/Mobile-Expensify(OldDot Android), not this repo — see the analysis above for the recommended order of changes.view run
melvin-bot commentedon Sep 4, 2026
@mkhutornyi Whoops! This issue is 2 days overdue. Let's get this updated quick!
melvin-bot commentedon Sep 5, 2026
@mkhutornyi Whoops! This issue is 2 days overdue. Let's get this updated quick!
13 remaining items
mkhutornyi commentedon Sep 30, 2026
yes sorry it meant
Awaiting Payment[-][Sentry: APP-JZ] Android OldDot crash — RxJava UndeliverableException from reactivelocation2 GoogleAPIConnectionSuspendedException[/-][+][Due for payment 2026-09-30] [Sentry: APP-JZ] Android OldDot crash — RxJava UndeliverableException from reactivelocation2 GoogleAPIConnectionSuspendedException[/+]melvin-bot commentedon Sep 30, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Oct 1, 2026
Payment Summary
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Oct 3, 2026
Payment Summary
Contributor+: @mkhutornyi due $250 via NewDot
trjExpensify commentedon Oct 15, 2026
approved $250 for @mkhutornyi