This document records how we discovered and fixed common issues in pb-mapper.
- Symptom: UI stutters or becomes unresponsive when probing server status.
- Discovery: Reproduced by opening the UI and watching the main thread stall during FFI calls.
- Root cause: FFI calls ran on the UI isolate and blocked the render thread.
- Fix: Move all FFI calls into a background isolate (via
compute) and add a lightweight status cache with polling to keep the UI responsive.
- Symptom:
Failed to load dynamic library 'libpb_mapper_ffi.so'at startup. - Discovery: Reproduced after
flutter build linuxand launching the bundle. - Root cause: FFI shared library was not built/copied into the app bundle.
- Fix: Add platform-specific build scripts and Makefile targets to compile and stage the FFI library into the correct bundle location (also reused by release jobs).
- Symptom: Panic from
trust-dns-resolverwhen using custom domain resolution. - Discovery: Reproduced by entering a custom domain and watching the runtime panic.
- Root cause: Sync resolver path called
block_oninside an async runtime. - Fix: Add an async DNS resolution path and guard sync resolution so it cannot execute inside a Tokio runtime.
- Symptom: Status cards remain stale until manual refresh.
- Discovery: Reproduced by registering/connecting and observing no UI update.
- Root cause: UI did not re-fetch status after actions and relied on stale cache.
- Fix: Trigger short polling after register/connect and add retry polling when re-checking availability.
- Symptom: Streaming/downloading a specific video repeatedly resets connections; logs spam
read checksum/connection reset. - Discovery: Traced to
forward.rserrors and frequent reconnects after stream termination. - Root cause: Forwarding ended abruptly without half-close support; expected EOFs were logged as errors.
- Fix: Add half-close (
shutdown) support in forward writers, allow both directions to finish, and downgrade expected disconnects (EOF/reset/broken pipe) to debug logs.