Repository navigation
fix(rust): log datastore write errors instead of discarding them - #366
Merged
ErikBjare merged 2 commits intoOct 14, 2026
Merged
Conversation
heartbeat() reports a failed write by returning an {"error": ...} object
rather than throwing. heartbeatHelper() dropped that response (its log
line was commented out) and insertEvent() logged it only at debug level,
so a watcher could lose every event for hours, for example while its
bucket is missing or after the datastore worker died, with nothing in
logcat to show it.
Log a warning for the first failed write of a run and, once a write to
the same bucket succeeds again, how many failed in between. Runs are
counted per bucket in one log for the whole process, like the datastore
itself, because the batch watchers build a new RustInterface on every
read. insertEvent() no longer logs every response at debug level, and
heartbeat() is declared nullable: the native side returns null when it
cannot build even its error object.
…omment The comment said RustInterface construction and createBucketHelper() make JNI/HTTP calls to an aw-server that may not be running yet at boot. They never go through the HTTP server: the JNI calls open the datastore in the app's own process. Say only that they can block for seconds, which is why they run on the handlerThread, and leave the reasons to the code that blocks.
|
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.
Problem
heartbeat()reports a failed write by returning an{"error": …}object; it never throws.RustInterface.heartbeatHelper()discarded that response (itsLog.wwas commented out), andinsertEvent()logged it only at debug level, mixed in with every successful response. A watcher whose writes fail therefore loses every event with nothing in logcat to show it.One way to get there: deleting the media or web bucket from the web UI while the app runs. Those watchers create their bucket only when their service starts, so every later heartbeat fails with
NoSuchBucketuntil the service is recreated. A datastore worker that has died fails all writes the same way.Change
WriteFailureLoglogs a warning for the first failed write of a run and, once a write to the same bucket succeeds again, how many failed in between. A line per failure would flood logcat, since watchers write every few seconds.RustInterfaceon every read, and a run of failures has to outlive them.heartbeatHelper()andinsertEvent()pass every response to it.insertEvent()no longer logs each response at debug level.heartbeat()is declaredString?: the native side returns null when it cannot build even its error object, and that counts as a failed write.MediaWatcher.onCreate: its init calls never go through the HTTP server, so whether the server has started doesn't matter.#359 reads the same
{"error": …}object ingetBucketsJSON(). Once one of the two PRs is merged, the other can reuse its check instead of adding a second copy.Testing
WriteFailureLogTest: no log on success, one line per run of failures, the recovery count, buckets counted separately, a missing response, and parsing of the error object../gradlew :mobile:testStandardDebugUnitTestpasses.