Android: SQLite has no temp directory, so the champion index never builds #190
Closed
opened 2026-08-21 20:17:52 +00:00 by logan
·
1 comment
No Branch/Tag Specified
main
fix/146-stub-etxtbsy
fix/175-wizard-follows-the-library
fix/231-setter-rollback
fix/197-duplicate-column-label
docs/225-fixtures-wav-tags
docs/220-skill-check-scope
test/217-fixture-names-in-queue-selection
fix/216-riff-parse-allocation
fix/170-queue-header-action-names
fix/210-nav-sheet-scroll-affordance
docs/50-readme-landing-page
feat/65-art-prefetch-ahead
feat/71-more-as-a-bottom-sheet
feat/54-native-touch-feel
feat/67-entity-links-into-menus
test/196-visual-tier-gates
fix/138-ui-test-storage-leak
fix/104-wav-tags-read
fix/207-sheet-scroll-affordance
fix/204-ui-visual-update-filter
pi-agent-backlog-automation
63-touch-model-phase-2
63-android-touch-model
186-touch-targets-settings
186-touch-targets-page-header
187-seek-bar-hit-area
189-190-explore-correctness
135-android-underrun-instrumentation
51-android-small-screens
fix/171-phone-queue-scrim
fix/137-touch-only-affordances
fix/154-nested-css-check
feat/58-mini-player-progress-line
fix/66-album-page-scrolls-as-one
60-context-menu-action-sheet
64-android-system-volume
59-slim-the-mini-player
55-queue-as-a-screen
feat/57-drop-the-android-top-bar
feat/62-jobs-as-a-notification
fix/53-seek-bar-never-moves
fix/159-android-task-app-id
fix/52-android-activity-recreation-restarts-the-process
fix/150-expand-button-under-the-art
feat/42-inline-volume-and-centred-transport
fix/156-queue-selection-fixture-order
fix/151-fuse-the-scroll-guard-and-the-write
fix/43-queue-panel-selection
fix/143-top-bar-fits-its-window
feat/27-jobs-into-settings
feat/25-configurable-sidebar-tabs
feat/6-global-back-forward
fix/72-active-view-broadcast
fix/69-page-header-action-overflow
fix/quick-wins-batch
fix/118-in-library-clear
fix/61-mini-player-plain-text
fix/68-hover-affordances-pointer
fix/119-dev-headless-port
fix/130-issue-claim-user
fix/131-codegen-check-scope
feat/28-autotag-match-on-album
feat/17-demote-version-selector
feat/38-ownership-visibility
ci/115-manual-release
feat/34-icon-language
feat/7-full-tracklist-toggle
fix/16-tagwriter-totals
fix/unclaim-ca-certs
fix/unclaim-shell
ci/unclaim-on-close
docs/closing-keyword
docs/retire-stale-planning-docs
docs/issue-driven-workflow
integration/small-fixes
fix/small-issue-batch
fix/queue-toggle-state
fix/drag-count-badge
fix/album-card-year
fix/album-tracklist-heading
fix/seek-bar-clock-width
fix/explore-art-scanner-requests
chore/workflow-guardrails
v0.7.0
v0.6.0
v0.5.0
v0.4.0
v0.3.1
v0.3.0
v0.2.3
v0.2.2
v0.2.1
v0.2.0
v0.1.0
v0.0.1
v0.0.0
Labels
Clear labels
Area/Design
Area/Downloads
Area/Explore
Area/Library-UI
Area/Metadata
Area/Packaging
Area/Player
Area/Queue
Area/Settings
Area/Shell-Nav
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Platform/Android
Platform/Desktop
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
1
The priority is critical
Priority
High
2
The priority is high
Priority
Medium
3
The priority is medium
Priority
Low
4
The priority is low
Reviewed
Confirmed
1
Issue has been confirmed
Reviewed
Duplicate
2
This issue or pull request already exists
Reviewed
Invalid
3
Invalid issue
Reviewed
Won't Fix
3
This issue won't be fixed
Status
Blocked
1
Something is blocking this issue or pull request
Status
Need More Info
2
Feedback is required to reproduce issue or to continue work
Status
Abandoned
3
Somebody has started to work on this but abandoned work
Status
In Progress
Somebody is actively working on this right now
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: yonlu/yellowjacket#190
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Report
The champion search index never builds on Android. It fails with a
SQLite I/O error whose extended code names the cause exactly:
there is no temp directory.
Measured on the reference device (TLP301, Android 14, arm64) with a
1,577-track library and a populated catalog (
search index: using existing index entries=1079667). Found in the first minute of logcatafter #160 landed; it is written on every launch and was going to
/dev/nullbefore that.Findings
6410is not a generic I/O error. SQLite's extended result codes packthe detail into the high bits:
SQLite could not work out where to put a temporary file. Two
measurements on the device say why:
Android has no
/tmp, and the app's process has noTMPDIR. Thezygote does not set one — a shell does (
/data/local/tmp), which iswhy this is easy to miss from
adb shell. Go'sos.TempDir()fallsback to
/tmpwhenTMPDIRis unset, so the pure-Go SQLite driverasks for a temp path, is handed a directory that does not exist, and
returns GETTEMPPATH.
The statement that trips it is the champion FTS populate in
backend/explore/searchindex.go:An
INSERT ... SELECTof that size against an FTS table spills, whichis when a temp file is wanted. So the trigger is the size of the
work, not this statement in particular — anything that spills fails
the same way on this platform, which makes this a class rather than
one query. Large sorts, large joins and
VACUUMare the usual others.What it costs
championReadystays false, so every Explore search on Android takesthe generic path over the whole 1,079,667-row index instead of the
champion subset the rebuild exists to produce. It is a silent
performance cliff on the slowest device this app runs on, and it
re-attempts on every launch, so the cost is paid repeatedly.
Direction
Two candidate fixes, and they are not equivalent:
TMPDIRfor the process on Android, from the app's owncache dir, next to where
system.UseHomeOverride(application.Mobile .StoragePath())already runs inmain.go. This fixes the classrather than the statement, and it fixes it for anything else in the
process that calls
os.TempDir(). It needs a real writabledirectory the app owns —
getCacheDir()is the Android answer, andwhether Wails exposes it needs checking (
Mobile.StoragePath()isgetFilesDir(), which would work but is the durable directory, nota cache).
PRAGMA temp_store = MEMORYon the connection, which stopsSQLite wanting a file at all. Cheaper and more local, but it is a
promise about every future spill fitting in RAM on a phone, and
the catalog is the largest thing in this app. It also silently
changes the memory profile of statements nobody is thinking about.
(1) is the better default and (2) is worth considering in addition
for the catalog specifically. Whichever is chosen, the check is that
champion index rebuiltappears inmake android-logswherechampion index rebuild failedis today.Worth knowing
No tier here can see this: it is a property of the process environment
on one platform, and CI, the e2e harness and every desktop run have a
/tmp. The diagnosis is entirely in the extended result code, sowhatever logs a SQLite error should keep logging the number — a
message reading only "disk I/O error" would have led nowhere.
Taking this together with #189 on
189-190-explore-correctness.Going with direction (1),
TMPDIR, overPRAGMA temp_store = MEMORY:it fixes the class rather than the statement, and it covers anything
else in the process that calls
os.TempDir().It also needs no new Wails API, which is a correction to what I wrote
above. The issue says a cache dir is wanted and that whether Wails
exposes one needs checking. It does not need one:
system.UseHomeOverride(application.Mobile.StoragePath())already runsin
main.goand gives an app-owned writable directory, so TMPDIR canpoint at a subdirectory of YJ_HOME with no Java change and nothing new
from the runtime.