Indeterminate state during IPC command failure in Tauri backend
21.8K reputation · 10 Jun 2022, 17:36 UTC
IPC Communication and State Consistency
Tauri utilizes an asynchronous JSON-RPC based bridge for communication between the JavaScript frontend and the Rust backend. When a tauri::command is invoked, a failure during serialization or a process-level glitch can leave the frontend unable to determine if the backend logic completed its write operation before the error occurred.
Idempotency Constraints
Because the framework does not provide built-in transactional atomicity or automatic de-duplication across the IPC boundary, manual retry logic implemented on the frontend risks creating duplicate records if the initial request succeeded but the response was lost.
What is the recommended pattern for implementing request-based idempotency within the tauri::command state system to ensure write operations are not duplicated during retries? Which synchronization primitives are most appropriate for tracking request identifiers to avoid race conditions without causing significant performance bottlenecks?