fix: filter tracing to INFO for wzp crates, WARN for jni crate
Some checks failed
Mirror to GitHub / mirror (push) Failing after 38s
Build Release Binaries / build-amd64 (push) Failing after 4m7s

The jni crate emits VERBOSE logs for every JNI method lookup (~10 lines
per call, 100+ calls/sec on audio threads). This floods logcat, consumes
CPU, and triggers system kills. Filter to only show INFO+ for our crates
and WARN+ for everything else.

Also fix build script: clean full Rust target to ensure libc++_shared.so
is always copied by cargo-ndk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-06 21:37:29 +04:00
parent b56b4a759c
commit 5e93cb74f2
3 changed files with 17 additions and 2 deletions

View File

@@ -17,7 +17,7 @@ wzp-crypto = { workspace = true }
wzp-transport = { workspace = true } wzp-transport = { workspace = true }
tokio = { workspace = true } tokio = { workspace = true }
tracing = { workspace = true } tracing = { workspace = true }
tracing-subscriber = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] }
bytes = { workspace = true } bytes = { workspace = true }
serde = { workspace = true } serde = { workspace = true }
serde_json = "1" serde_json = "1"

View File

@@ -41,8 +41,17 @@ fn init_logging() {
let _ = std::panic::catch_unwind(|| { let _ = std::panic::catch_unwind(|| {
use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::layer::SubscriberExt;
use tracing_subscriber::util::SubscriberInitExt; use tracing_subscriber::util::SubscriberInitExt;
use tracing_subscriber::EnvFilter;
if let Ok(layer) = tracing_android::layer("wzp_android") { if let Ok(layer) = tracing_android::layer("wzp_android") {
let _ = tracing_subscriber::registry().with(layer).try_init(); // Filter: INFO for our crates, WARN for everything else.
// The jni crate emits VERBOSE logs for every method lookup
// (~10 lines per JNI call, 100+ calls/sec) which floods logcat
// and causes the system to kill the app.
let filter = EnvFilter::new("warn,wzp_android=info,wzp_proto=info,wzp_transport=info,wzp_codec=info,wzp_fec=info,wzp_crypto=info");
let _ = tracing_subscriber::registry()
.with(layer)
.with(filter)
.try_init();
} }
}); });
}); });

View File

@@ -196,6 +196,12 @@ do_upload() {
do_build() { do_build() {
log "Building Rust native library (arm64-v8a, release)..." log "Building Rust native library (arm64-v8a, release)..."
# Clean Rust release target to force full rebuild.
# cargo-ndk only copies libc++_shared.so when it actually links — a partial
# clean that skips relinking leaves libc++_shared.so missing from jniLibs.
ssh_cmd "rm -rf /root/wzp-build/target/aarch64-linux-android/release \
/root/wzp-build/android/app/src/main/jniLibs/arm64-v8a"
# ANDROID_NDK must be set (not just ANDROID_NDK_HOME) — cmake checks it # ANDROID_NDK must be set (not just ANDROID_NDK_HOME) — cmake checks it
ssh_cmd "source \$HOME/.cargo/env && \ ssh_cmd "source \$HOME/.cargo/env && \
export ANDROID_HOME=\$HOME/android-sdk && \ export ANDROID_HOME=\$HOME/android-sdk && \