Android app stays on the splash screen on first launch after install when Python init fails
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Target branch: release-v0.20.x
Observed behavior
- On the first launch after install, the main process and
:task_workerboth start Python and extract chaquopy'sAssetFinder/requirementsat the same moment. :task_workercrashed inApp.onCreateand Android restarted it, after which it initialised normally.- The main process's
KolibriEnvironmentInitializerfailed, soKolibriServerServicenever started the HTTP server. - The app stayed on the splash screen until force-stopped; the next launch reached the setup wizard.
Errors and logs
:task_worker:
E AndroidRuntime: java.lang.RuntimeException: Unable to create application org.learningequality.Kolibri.App: com.chaquo.python.PyException: FileNotFoundError: [Errno 2] No such file or directory: 'noto-subset.pt-br-0b75e6d0bb605251080ffc9c7a7902a8.css.gz.t47hdr62'
Main process, raised while monkey_patch_zeroconf was being imported:
E KolibriEnvInitializer: com.chaquo.python.PyException: FileNotFoundError: [Errno 2] No such file or directory: '/data/data/org.learningequality.Kolibri/files/chaquopy/AssetFinder/requirements/kolibri/dist/django/contrib/admin/static/admin/js/vendor/select2/i18n/hsb.js.gz.3h22j7e0'
at <python>.tempfile.NamedTemporaryFile(tempfile.py:575)
at <python>.java.chaquopy.import_override(import.pxi:26)
at <python>.monkey_patch_zeroconf.<module>(monkey_patch_zeroconf.py:2)
...
at org.learningequality.Kolibri.KolibriEnvironmentInitializer.initializeKolibri(KolibriEnvironmentInitializer.java:138)
E KolibriServerService: java.util.concurrent.CompletionException: java.lang.RuntimeException: Failed to initialize Kolibri
User-facing consequences
- A user who has just installed Kolibri sees only the splash screen and has to force-stop the app to get past it.
Steps to reproduce
- Install the debug APK built from
release-v0.20.x(seen on0.20.0a2.dev1730+g5a35a50b7) on an API 30 emulator. - Launch Kolibri from the launcher before it has ever run.
- Watch
adb logcatfor the errors above while the splash screen stays up.
Context
- Kolibri
0.20.0a2.dev1730+g5a35a50b7-debug - Android 11 (API 30) x86_64 emulator
Acceptance Criteria
- [ ] The first launch after install reaches the setup wizard without a force-stop.
- [ ] Neither process logs a
FileNotFoundErrorfrom chaquopy asset extraction on that launch.
AI usage
Claude Code hit this during automated Android QA of the #15765 branch, captured the logcat, and drafted this issue.
Plan: First launch after install reaches the setup wizard: the main and :task_worker processes no longer delete each other's Chaquopy asset extraction.
- [ ] Cross-process lock helper
- [ ] Take the lock around Python startup and the kolibri import
- [ ] Self-review the produced code
Assumptions — the issue did not settle these; say so if one is wrong.
- No prefs flush after
Python.start: the lock is held through the kolibri extraction, which outlastsapply(). If wrong, a latermtreeremains; add an emptyedit().commit()on Chaquopy's prefs. - No lock-wait timeout, unlike
migration_lock.py: the OS releases the lock when its holder dies. If a hung holder must be survived, polltryLockagainst a deadline. - Chaquopy supports
Python.startoff the main thread. If not, the start stays on the main thread, and waiting for the lock there risks an ANR. - Init failure still leaves the splash screen up with no retry. If recovery is wanted,
KolibriServerServiceneeds a retry path, which this branch does not add.
Written by rtibblesbot, an LLM-based coding agent.
Fixed in #15768