Closed Bug 1251057 Opened 4 years ago Closed 4 years ago

tokenserver errors don't log useful diagnostics


(Firefox :: Sync, defect, P1)




Firefox 48
Tracking Status
firefox48 --- fixed


(Reporter: markh, Assigned: markh)



(1 file)

I've seen a few logs with entries like:

> 1456349228080	Common.TokenServerClient	DEBUG	Beginning BID assertion exchange: http://xxxx-host-deleted/storage/1.5/1
> 1456349230611	Sync.BrowserIDManager	ERROR	Non-authentication error in _fetchTokenForUser: TokenServerClientNetworkError({"error":{}}) (resource://gre/modules/services-common/tokenserverclient.js:39:36) JS Stack trace: TokenServerClientNetworkError@tokenserverclient.js:63:16 < onResponse@tokenserverclient.js:274:12 < onStopRequest@rest.js:467:7 < waitForSyncCallback@async.js:102:7 < makeSpinningCallback/callback.wait@async.js:156:27 < onNotify@service.js:1009:7 < WrappedNotify@util.js:148:21 < WrappedLock@util.js:103:16 < WrappedCatch@util.js:77:16 < login@service.js:1031:12 < sync/<@service.js:1283:14 < WrappedCatch@util.js:77:16 < sync@service.js:1279:5
> 1456349230612	Sync.Status	DEBUG	Status.login: =>

(note that xxx-host-deleted was a real self-hosted server name)

This log gives no information about why the call failed - we should try and arrange so there is (eg, an NS_ERROR_ code if the request wasn't created, a response code if it was, etc)
Flags: firefox-backlog+
Assignee: nobody → markh
Priority: -- → P1
Hey Drew,

There are a couple of parts to this patch:

* The LogManager, which we created for readinglist to share logging logic with Sync, unconditionally sets all of its logs to the "ALL" level. This was done as a bit of a hack for readinglist, but is flawed in that depending on timing, the log levels may or may not be overridden later, and for some log where the level is *not* overwritten later, that log level may expose information we don't want in logs.

* rest.js has 2 objects (a request and response object) but they used completely different log names. I've fixed that to use a consistent name (dxr tells me there are no references to the name I changed). Worse, services-common.js has a preference to control the log level, but the code uses the wrong preference prefix, meaning those prefs had no effect - I fixed that too.

* rest.js didn't log the URL of the connection it was making until it got a response, which makes the log harder to read then they should be.

* Sync's log manager is configured to log the output from these rest.js loggers to the sync log sinks.

The end result is that we now end up with log lines like the following in sync logs:

> 1457417896798   Services.Common.RESTRequest     DEBUG   GET request to
> 1457417896802   Services.Common.RESTRequest     DEBUG   GET failed: 2152398878 - NS_ERROR_UNKNOWN_HOST


Attachment #8727721 - Flags: review?(adw)
Attachment #8727721 - Flags: review?(adw) → review+
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
You need to log in before you can comment on or make changes to this bug.