Closed Bug 1172157 Opened 9 years ago Closed 9 years ago

Profiler returning malformed JSON

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: vporof, Assigned: shu)

Details

Attachments

(1 file, 1 obsolete file)

error occurred while processing 'getProfile: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
Stack: ProfilerActor.prototype.onGetProfile@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/profiler.js:182:19
DSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1469:15
LocalDebuggerTransport.prototype.send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/transport/transport.js:569:11
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14
Line: 182, column: 18

onPacket threw an exception: Error: Server did not specify an actor, dropping packet: {"error":"unknownError","message":"error occurred while processing 'getProfile: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data\nStack: ProfilerActor.prototype.onGetProfile@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/profiler.js:182:19\nDSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1469:15\nLocalDebuggerTransport.prototype.send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/transport/transport.js:569:11\nmakeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14\nmakeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14\nLine: 182, column: 18"}
Stack: DebuggerClient.prototype.onPacket@resource://gre/modules/devtools/dbg-client.jsm:968:1
LocalDebuggerTransport.prototype.send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/transport/transport.js:569:11
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14
Line: 968, column: 0
Happened while profiling this page.
Was it a fresh-ish instance or one running for a few hours/days?

Saw an exception in C++ with similar but assumed it was me.
Flags: needinfo?(shu)
Summary: Finished recording hangs while loading with error "Server did not specify an actor, dropping packet: " → Profiler returning malformed JSON
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #2)
> Was it a fresh-ish instance or one running for a few hours/days?
> 
> Saw an exception in C++ with similar but assumed it was me.

A few hours old firefox.
Saves malformed JSON to ~/bad-profile.json. We'll back this out after catching
where the parse error is exactly.
Attachment #8616281 - Flags: review?(bgirard)
Assignee: nobody → shu
Status: NEW → ASSIGNED
Flags: needinfo?(shu)
I wonder if it's bug 1167895.
Comment on attachment 8616281 [details] [diff] [review]
Save malformed profile JSON to file to help debug.

Review of attachment 8616281 [details] [diff] [review]:
-----------------------------------------------------------------

::: tools/profiler/TableTicker.cpp
@@ +230,5 @@
> +      if (homePath) {
> +        nsCString path;
> +        path.Append(homePath);
> +        path.Append('/');
> +        path.Append("bad-profile.json");

I don't like the idea of writing files on people' disk. The nightly population is much more than just mozilla employees. This is used by devtools now so a lot of people can hit this code. This would be a bit better if we wrote this out in the profile directory.

How about just sending it to stdout? It's not that uncommon so we should watch stdout.
Attachment #8616281 - Flags: review?(bgirard) → review-
Write out to a temp dir instead.
Attachment #8616281 - Attachment is obsolete: true
Attachment #8616832 - Flags: review?(bgirard)
Comment on attachment 8616832 [details] [diff] [review]
Save malformed profile JSON to file to help debug.

Review of attachment 8616832 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good. Might want to add a notification to stdout.
Attachment #8616832 - Flags: review?(bgirard) → review+
Can we have a pref that specifies a path to dump this too? Then we can opt in
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #9)
> Can we have a pref that specifies a path to dump this too? Then we can opt in

I was planning on backing this out when we actually catch the error. Too much work for a temporary thing.
(In reply to Benoit Girard (:BenWa) from comment #8)
> Comment on attachment 8616832 [details] [diff] [review]
> Save malformed profile JSON to file to help debug.
> 
> Review of attachment 8616832 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Looks good. Might want to add a notification to stdout.

Sure, will do.
Keywords: leave-open
I asked Jordan and Victor in person about seeing any dumped malformed profiles, and they didn't see any.

Benoit and Markus, have you seen any?
Flags: needinfo?(mstange)
Flags: needinfo?(bgirard)
I haven't seen this since this landed, seems fixed to me.
Flags: needinfo?(mstange)
Yes I haven't seen it either. I've checked a few times in the past and again today.

Looks like this no longer fails for some reason.
Flags: needinfo?(bgirard)
Nobody has seen any bad profiles for a while. Backed out temporary dumping patch in https://hg.mozilla.org/integration/mozilla-inbound/rev/004e8bb3f339
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
I can reproduce this issue with Firefox 40.0.2 on 64bit Linux by running a runtime analysis on this Bugzilla page (open this page, start runtime analysis, refresh page, end runtime analysis, see exception in .xsession-errors). Here's the log output:

onPacket threw an exception: Error: Server did not specify an actor, dropping packet: {"error":"unknownError","message":"error occurred while processing 'getProfile: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data\nStack: ProfilerActor.prototype.onGetProfile@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/actors/profiler.js:182:19\nDSC_onPacket@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/server/main.js:1456:15\nLocalDebuggerTransport.prototype.send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/transport/transport.js:561:11\nmakeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14\nmakeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14\nLine: 182, column: 18"}
Stack: DebuggerClient.prototype.onPacket@resource://gre/modules/devtools/dbg-client.jsm:944:1
LocalDebuggerTransport.prototype.send/<@resource://gre/modules/devtools/dbg-client.jsm -> resource://gre/modules/devtools/transport/transport.js:561:11
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14
makeInfallible/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/devtools/DevToolsUtils.js:82:14
Line: 944, column: 0
Seems like this issue is related to an Add-In (uBlock Origin). Here's the related issue: https://github.com/gorhill/uBlock/issues/627
Looks like the fix for this (bug 1167895) only landed in Firefox 41, not in 40. So unfortunately it looks like this is going to stay unfixed until Firefox 41 will be released.
Removing leave-open keyword from resolved bugs, per :sylvestre.
Keywords: leave-open
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: