Skip to content
New issue

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

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

Already on GitHub? # to your account

Auto-Downloads Sometimes Overlap and Corrupt the File #2073

Closed
ImranR98 opened this issue Jan 13, 2025 · 1 comment
Closed

Auto-Downloads Sometimes Overlap and Corrupt the File #2073

ImranR98 opened this issue Jan 13, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@ImranR98
Copy link
Owner

In certain conditions, android seems to pause the background job and resume it later. If this time gap is larger than the update checking interval, we end up with the same app being downloaded in 2 simultaneous background processes. Both processes write to the same file, overwriting each other and resulting in a corrupt APK (the resulting error usually reads "could not get ID from APK").

This could be fixed by checking whether a file is actively being written to before starting a download. If it is, we assume there is already another download in progress and avoid starting a new one. The simplest way to check is probably just reading the file size, then reading it again 5 seconds later (unless the connection is very slow, an existing download should have progressed a bit over that time).

This would also prevent this issue from happening if a user tries manually updating while a background update is already in progress.

@ImranR98 ImranR98 added bug Something isn't working TODO Issue to focus on for the next release labels Jan 13, 2025
ImranR98 added a commit that referenced this issue Jan 28, 2025
- Attempt to fix "double download" bug (#2073)
- Avoid JSON corruption when storage full (#2089)
- Fix error when GitLab repo is in a subgroup (#2079)
- Update screenshots in README
@ImranR98
Copy link
Owner Author

Assuming fixed: https://github.com/ImranR98/Obtainium/releases/tag/v1.1.40
Will reopen if not.

@ImranR98 ImranR98 removed the TODO Issue to focus on for the next release label Jan 28, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant