bluepill icon indicating copy to clipboard operation
bluepill copied to clipboard

trace-profile.json is not a valid json

Open RainNapper opened this issue 5 years ago • 2 comments

The trace-profile.json uses "nan" in some entries. I do not know exactly under what circumstances "nan" is used, but when this file is loaded by chrome://tracing, it will throw an error for an invalid character. Error:

While importing:
SyntaxError: Unexpected token a in JSON at position 6502
    at JSON.parse (<anonymous>)
    at new TraceEventImporter (chrome://tracing/tracing.js:5498:19)
    at Import.createImporter_ (chrome://tracing/tracing.js:1332:8)
    at chrome://tracing/tracing.js:1326:167
    at Task.run (chrome://tracing/tracing.js:2553:95)
    at runAnother (chrome://tracing/tracing.js:2556:371)
    at runTask (chrome://tracing/tracing.js:2321:57)
    at processIdleWork (chrome://tracing/tracing.js:2326:116)
    at window.requestIdleCallback.timeout (chrome://tracing/tracing.js:2319:81)

Example line:

{"name":"CPU", "ph": "C", "ts": "1587074269993629", "pid": 1, "args": {"sys": nan, "usr": nan, "idle": nan}},

In the meantime, I've been able to work around this issue using:

cat trace-profile.json | sed "s/nan/0/g" > trace-profile-fixed.json

RainNapper avatar Apr 17 '20 21:04 RainNapper

Thanks for the temporary fix. I guess some missing entries are breaking the trace profile json. Bluepill should be outputting 0 or something appropriate. I will take a look.

ravimandala avatar Jul 28 '20 21:07 ravimandala

@RainNapper nan means NotANumber.

This looks like a bad exception handling. Will look into it. Thanks for reporting!

chenxiao0228 avatar Dec 19 '20 22:12 chenxiao0228