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.


Change-Id: I7b4c64560f1f0838db150bb889d11a8ece97de9c
Signed-off-by: Chung-yih Wang <>
Reviewed-by: Dan Shi <>
diff --git a/ b/
index 98ac059..fc16a1c 100644
--- a/
+++ b/
@@ -208,10 +208,13 @@
   def _ReadMetadataFromStream(cls, stream):
     """Returns metadata obj from input json stream that implements .read()."""
+    data = None
     file_attr_dict = {}
-      file_attr_dict = json.loads(
-    except IOError:
+      data =
+      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)