fix(cuprate): seed XDG so Android parse does not poison LazyLock #128

Merged
sirius merged 1 commit from onionwire/cuprate-android-xdg into main 2026-09-19 21:56:12 +00:00
Owner

The red line cuprate panicked: LazyLock instance has previously been poisoned is the second panic.

Cuprate #[serde(default)] fills missing nested structs via Default. ArtiConfig::default unwraps dirs::data_dir(). On Android dirs-sys has no getpwuid fallback and HOME is unset, so that is None, the first Start panics, and a retry poisons the process-wide LazyLock.

  • Seed XDG_DATA_HOME / XDG_CACHE_HOME / XDG_CONFIG_HOME (and a non-root HOME if missing or /) to the chain datadir before toml::from_str.
  • Put [tor.arti] directory_path in the TOML so serde never calls ArtiConfig::default.
  • If a poison still happens, the error tells the user to force-stop — it cannot recover in-process.

Host tests: cargo test --locked --target x86_64-unknown-linux-gnu --features cuprate-daemon --lib cuprate — 5 passed.

After merge this needs a new APK. Force-stop the current install before retrying; a poisoned LazyLock lives until process death.

The red line `cuprate panicked: LazyLock instance has previously been poisoned` is the *second* panic. Cuprate `#[serde(default)]` fills missing nested structs via `Default`. `ArtiConfig::default` unwraps `dirs::data_dir()`. On Android `dirs-sys` has no getpwuid fallback and `HOME` is unset, so that is `None`, the first Start panics, and a retry poisons the process-wide LazyLock. - Seed `XDG_DATA_HOME` / `XDG_CACHE_HOME` / `XDG_CONFIG_HOME` (and a non-root `HOME` if missing or `/`) to the chain datadir *before* `toml::from_str`. - Put `[tor.arti] directory_path` in the TOML so serde never calls `ArtiConfig::default`. - If a poison still happens, the error tells the user to force-stop — it cannot recover in-process. Host tests: `cargo test --locked --target x86_64-unknown-linux-gnu --features cuprate-daemon --lib cuprate` — 5 passed. After merge this needs a new APK. Force-stop the current install before retrying; a poisoned LazyLock lives until process death.
fix(cuprate): seed XDG so Android parse does not poison LazyLock
All checks were successful
ci / sdk (pull_request) Successful in 1m7s
ci / test (pull_request) Successful in 5m20s
ci / fuzz (pull_request) Successful in 5m2s
android-ci / android (pull_request) Successful in 12m23s
c00c9d4151
Cuprate's serde defaults call ArtiConfig::default, which unwraps
dirs::data_dir(). On Android HOME is unset and dirs-sys has no
getpwuid fallback, so the first Start panics and a retry reports
"LazyLock instance has previously been poisoned". Point XDG at the
chain datadir before parse and set tor.arti.directory_path in TOML.
sirius merged commit bc74b4f4af into main 2026-09-19 21:56:12 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sirius/onionwire!128
No description provided.