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

Auto-Downloads Sometimes Overlap and Corrupt the File #2073

Open
ImranR98 opened this issue Jan 13, 2025 · 0 comments
Open

Auto-Downloads Sometimes Overlap and Corrupt the File #2073

ImranR98 opened this issue Jan 13, 2025 · 0 comments
Labels
bug Something isn't working TODO Issue to focus on for the next release

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TODO Issue to focus on for the next release
Projects
None yet
Development

No branches or pull requests

1 participant