Skip to content

[FLW-Mobile-App] Bug: Severe Storage Exhaustion due to orphaned cache files during down-sync operations #162

@vibhutomer

Description

@vibhutomer

Description:
During down-sync operations in several modules, the local Room database is cleared (clearAll()) and repopulated with server data. However, the Base64 images attached to these payloads are saved to physical storage using System.currentTimeMillis() in the filename.

Because the old files are never deleted and the new files get entirely unique timestamped names, every sync creates a full duplicate set of images on the user's disk. For field workers syncing daily, this results in rapid storage bloat, eventually leading to IOException: No space left on device.

Affected Files:

  • SaasBahuSammelanRepo.kt
  • UwinRepo.kt
  • MaaMeetingRepo.kt

Expected Behavior:
The app should maintain a stable storage footprint regardless of how many times a user syncs.

Suggested Fix:
Refactor the file creation logic to use deterministic naming based on the entity ID and image index (e.g., "saas_bahu_${item.id}_img${index}.$ext"). This guarantees that subsequent syncs safely overwrite the existing cache files instead of infinitely accumulating orphaned duplicates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions