Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/azure-cli-core/azure/cli/core/auth/binary_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,11 @@ def load(self):
logger.debug("load: %s", self.filename)
try:
self.data = self._load()
except (pickle.UnpicklingError, EOFError) as ex:
# We still get exception after retry:
except Exception as ex: # pylint: disable=broad-exception-caught
# If we still get exception after retry, ignore all types of exceptions and use a new cache.
# - pickle.UnpicklingError is caused by corrupted cache file, perhaps due to concurrent writes.
# - EOFError is caused by empty cache file created by other az instance, but hasn't been filled yet.
# - AttributeError is caused by reading cache generated by different MSAL versions.
logger.debug("Failed to load cache: %s. Using a fresh one.", ex)
self.data = {} # Ignore a non-existing or corrupted http_cache

Expand Down