Data Not Syncing Across Devices: Diagnosis and Fix
Sync bugs are among the highest-effort-to-fix in app engineering. A message that appears on phone but not on tablet, a setting changed on web but not reflected on mobile, a cart item that vanishes bet
Sync bugs are among the highest-effort-to-fix in app engineering. A message that appears on phone but not on tablet, a setting changed on web but not reflected on mobile, a cart item that vanishes between devices — these feel simple but result from complex distributed-system problems. This guide covers patterns and fixes.
Symptoms
- Change on device A not visible on device B
- Change visible on B but vanishes
- Duplicate records created
- "Last change wins" behavior unclear
- Sync status never updates
Causes
1. Polling interval too long
App checks for updates every 5 minutes. User on device B made a change 30 seconds ago. Device A has not checked yet.
Fix: Push notifications for changes, not polling. Or server-sent events. Or WebSockets for active sessions.
2. Cache invalidation bug
App has cached "user profile" entity. Profile changed server-side. Cache not invalidated → stale data displayed.
Fix: Server sends cache invalidation signals. Client respects. ETag / If-None-Match for HTTP caches.
3. Conflict resolution silent
Two devices edit the same record. Last write wins. User on device A made earlier change → silently discarded.
Fix: Timestamps on every write. Show conflict to user or use CRDTs. At minimum, log conflicts.
4. Optimistic UI without reconciliation
Client updates local state, shows success. Server rejects silently. Local state stale.
Fix: After optimistic write, server response must be reconciled. On reject, revert local + notify user.
5. Offline queue not flushed
User offline, made changes, came back online. Queue should flush; bug prevents it.
Fix: Explicit flush on connectivity regained. Retry on failure. Unit-test queue drain.
6. Incorrect user / device identification
Sync scoped to wrong user ID (mix-up between test and prod accounts, or stale session). Changes sync to wrong account.
Fix: User ID verified on every write. Session refresh when uncertain.
7. Clock skew between devices
Client A timestamps write at 12:01. Client B at 12:00 (clock slow). Server picks "latest" by timestamp → B wins despite being earlier.
Fix: Server assigns authoritative timestamp. Never trust client clock for sync ordering.
8. Partial sync (some entities sync, others do not)
Notes sync. Attachments do not. User assumes full sync.
Fix: Sync must be atomic per-entity, or clearly communicate partial state.
9. Multi-region propagation delay
Write to US-east DB. Read from EU-west replica. Replication lag 5 seconds. User's immediate re-read shows old data.
Fix: Client pins to region for session, or read-after-write uses write region. Eventually consistent noted in UX.
10. Deletion not propagated
Delete on device A sends DELETE request. Device B polls for GET on that entity, gets 404, treats as "not found, maybe network" instead of "deleted."
Fix: Soft-delete with tombstones. Sync sees tombstone, removes local record.
Diagnosis
Reproduce
- Two devices, same account
- Make change on A
- Wait reasonable window (5-30 seconds)
- Check B
Inspect
- Network inspector on both devices
- Server logs for both device identifiers
- Sync service logs (if separate)
Isolate
- Is it a specific entity type?
- Specific user?
- Specific region?
- Only offline-queued writes, or live too?
Fix patterns
- Event-driven updates (push) over polling for real-time use cases
- Idempotent operations (replay-safe writes)
- Server-authoritative timestamps
- Conflict resolution UI for user-visible conflicts
- Sync state visible to user ("Synced 30s ago")
- Debug mode with sync event log visible to developers
How SUSA tests sync
SUSA cannot directly test cross-device sync (needs two devices / two sessions). What it can cover:
- Offline-queue behavior (toggle airplane mode mid-action; verify queue and replay)
- Cache invalidation (change on backend, verify client refetches)
- Conflict error messages (simulate concurrent edits via API)
For full sync testing, you need a test harness that drives two devices. SUSA's remote-agent architecture supports this — two agents, orchestrated.
susatest-agent test myapp.apk --network offline --steps 50
susatest-agent test myapp.apk --network network_recovery --steps 100
Sync bugs are costly to diagnose and costly to fix. Design for sync from day one; retrofitting is painful.
Test Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free