Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix model download status race conditions and integrity checks #165

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

a-ghorbani
Copy link
Owner

@a-ghorbani a-ghorbani commented Jan 8, 2025

Description

Two probable race conditions were identified in the model download process:

  1. Partially downloaded files could be marked as "downloaded" due to file existence checks
  2. Hash calculations could occur on incomplete files, leading to incorrect integrity checks

Solution
Modified the download process to:

  1. Track active downloads and prevent marking files as downloaded during download
  2. Clear hash at download start to force recalculation
  3. Only set isDownloaded and hash after confirmed successful download

Fixes #163
Fixes #164

Platform Affected

  • iOS
  • Android

Checklist

  • Necessary comments have been made.
  • I have tested this change on:
    • iOS Simulator/Device
    • Android Emulator/Device
  • Unit tests and integration tests pass locally.

@a-ghorbani a-ghorbani marked this pull request as ready for review January 8, 2025 16:35
@a-ghorbani a-ghorbani merged commit 8111bca into main Jan 8, 2025
2 of 3 checks passed
@a-ghorbani a-ghorbani deleted the fix/download-issues branch January 8, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant