autoupdate.py: Suppress ValueError exception

When devserver tries to read current update metadata requested by
several concurrent update ping requests, a race condition might happens
which causes the data read could be empty or corrupted. Instead of failing
the autoupdate, this patch suppresses the ValueError exception
intentionally because a new metadata will be calculated accordingly.

BUG=chromium:621148
TEST=None

Change-Id: I7b4c64560f1f0838db150bb889d11a8ece97de9c
Signed-off-by: Chung-yih Wang <cywang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/355431
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/autoupdate.py b/autoupdate.py
index 98ac059..fc16a1c 100644
--- a/autoupdate.py
+++ b/autoupdate.py
@@ -208,10 +208,13 @@
   @classmethod
   def _ReadMetadataFromStream(cls, stream):
     """Returns metadata obj from input json stream that implements .read()."""
+    data = None
     file_attr_dict = {}
     try:
-      file_attr_dict = json.loads(stream.read())
-    except IOError:
+      data = stream.read()
+      file_attr_dict = json.loads(data)
+    except (IOError, ValueError):
+      _Log('Failed to load metadata:%s' % data)
       return None
 
     sha1 = file_attr_dict.get(cls.SHA1_ATTR)