We're still seeing periodic failures in qlog from malformed json output,
so lets try to catch it.
Modify the verify-qlog.py script to, in the event of an exception in
json.loads, to replay the entire json file to the console, followed by
an exception indicating what line it died trying to parse.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23715)
def __init__(self, filename, msg):
Exception.__init__(self, f"file {repr(filename)}: {msg}")
+class Malformed(Exception):
+ def __init__(self, line, msg):
+ Exception.__init__(self, f"{line}: {msg}")
+
event_type_counts = {}
frame_type_counts = {}
raise Unexpected(filename, "expected JSON-SEQ leader")
line = line[1:]
- objs.append(json.loads(line))
+ try:
+ objs.append(json.loads(line))
+ except:
+ fi.seek(0)
+ fdata = fi.read()
+ print(fdata)
+ raise Malformed(line, "Malformed json input")
return objs
def check_header(filename, hdr):