fix(android): harden startup paths that turned a slow datastore into a hang - #262
Merged
ErikBjare merged 3 commits intoSep 14, 2026
Merged
Conversation
|
TimeToBuildBob
added a commit
to TimeToBuildBob/aw-android
that referenced
this pull request
Sep 14, 2026
…s on load Greptile on ActivityWatch#262: a failed subresource scheduled a full-page reload, and a successful onPageFinished reset the backoff without cancelling it, so a usable dashboard could keep reloading every 250 ms. Use the WebResourceRequest overload, ignore non-main-frame failures, and drop the pending retry once a page finishes loading.
…a hang Follow-ups from aw-android#261 (the migration itself is fixed in aw-server-rust#679): - BackgroundService: queue the hostname/legacy-bucket migrations once per process. onStartCommand ran twice on a single launch in the repro, so the blocking migration command was queued twice on the datastore worker. - WebUIFragment: replace the Thread.sleep(100) + immediate reload in onReceivedError with a Handler-based retry that backs off from 250 ms to 5 s and is cancelled in onDestroyView. The old loop blocked the main thread and hammered the server while it was still starting. - WebWatcher: create the bucket off the accessibility service's main thread, like MediaWatcher already does. Play vitals showed 'Executing service WebWatcher' ANRs parked in Datastore::get_buckets. Refs ActivityWatch#261 Git-Session-Id: f014c682-2061-5a22-bc8e-de14775b115a
…s on load Greptile on ActivityWatch#262: a failed subresource scheduled a full-page reload, and a successful onPageFinished reset the backoff without cancelling it, so a usable dashboard could keep reloading every 250 ms. Use the WebResourceRequest overload, ignore non-main-frame failures, and drop the pending retry once a page finishes loading. Git-Session-Id: f014c682-2061-5a22-bc8e-de14775b115a
WebView still calls onPageFinished after a failed main-frame load. Cancelling the pending Handler retry there dropped the ActivityWatch#261 backoff. Only a successful finish cancels; subresource errors still do not schedule. Git-Session-Id: f014c682-2061-5a22-bc8e-de14775b115a
TimeToBuildBob
force-pushed
the
fix/261-startup-hardening
branch
from
September 14, 2026 08:28
5b319e6 to
cc3c231
Compare
Contributor
Author
|
@greptileai review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-ups from #261. The root cause (quadratic legacy-bucket merge wedging the datastore worker) is fixed in ActivityWatch/aw-server-rust#679; this PR hardens the app-side paths that turned a busy datastore into a blank screen and ANRs, so the next slow datastore operation degrades gracefully instead. Not required for v0.14.1, but cheap and independent.
onStartCommandran twice on one launch, so the blocking migration command was queued twice on the single datastore worker.onReceivedErrorretry didThread.sleep(100)on the main thread and reloaded immediately, which turned a slow server start into a tight reload loop on the UI thread. Now aHandlerretry with backoff (250 ms → 5 s), reset on a successful page load and cancelled inonDestroyView. Unit test for the backoff.MediaWatcheralready uses). Play vitals list "Executing service WebWatcher" ANRs parked inDatastore::get_buckets.Still open after this (separate):
SessionEventWatcher/UsageStatsWatcherconstructRustInterfaceon whatever thread creates them, and the JNIgetBucketspathunwrap()s when the worker is gone (noted on the aw-server-rust PR).