Repository navigation
Conversation
Kryo does not run field initializers, so a stale or partially written downloadstate2.ser can deserialize with a null songs list. restore() then passed it to download(), which threw an NPE on songs.isEmpty() and took the service down on every start until the app cache was cleared. Validate the restored queue before using it and drop the saved state when it cannot be restored. Also make download() tolerate a null list.
Caches were written directly to their final path, so a process kill during serialization could leave a truncated file that is then read on the next start. Write to a unique temporary file and rename it into place, only after the Kryo stream has been closed.
deserializeDownloadQueueNow() runs on the service startup thread, so any exception while restoring the saved queue killed the process and the next start hit the same state again. Log the failure, drop the saved queue and let the service come up with an empty one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #182