Profiler returning malformed JSON

RESOLVED WORKSFORME

Status

()

Firefox
Developer Tools: Performance Tools (Profiler/Timeline)
RESOLVED WORKSFORME
3 years ago
2 years ago

People

(Reporter: vporof, Assigned: shu)

Tracking

({leave-open})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

3 years ago
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
(Reporter)

Comment 1

3 years ago
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
(Reporter)

Comment 3

3 years ago
(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.
(Assignee)

Comment 4

3 years ago
Created attachment 8616281 [details] [diff] [review]
Save malformed profile JSON to file to help debug.

Saves malformed JSON to ~/bad-profile.json. We'll back this out after catching
where the parse error is exactly.
(Assignee)

Updated

3 years ago
Attachment #8616281 - Flags: review?(bgirard)
(Assignee)

Updated

3 years ago
Assignee: nobody → shu
Status: NEW → ASSIGNED
Flags: needinfo?(shu)
(Assignee)

Comment 5

3 years ago
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-
(Assignee)

Comment 7

3 years ago
Created attachment 8616832 [details] [diff] [review]
Save malformed profile JSON to file to help debug.

Write out to a temp dir instead.
Attachment #8616281 - Attachment is obsolete: true
(Assignee)

Updated

3 years ago
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
(Assignee)

Comment 10

3 years ago
(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.
(Assignee)

Comment 11

3 years ago
(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.
(Assignee)

Updated

3 years ago
Keywords: leave-open

Comment 12

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/a047d84164b1
https://hg.mozilla.org/mozilla-central/rev/a047d84164b1
(Assignee)

Comment 14

3 years ago
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)

Comment 17

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/004e8bb3f339
(Assignee)

Comment 18

3 years ago
Nobody has seen any bad profiles for a while. Backed out temporary dumping patch in https://hg.mozilla.org/integration/mozilla-inbound/rev/004e8bb3f339
(Assignee)

Updated

3 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WORKSFORME

Comment 19

2 years ago
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

Comment 20

2 years ago
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.
You need to log in before you can comment on or make changes to this bug.