Closed Bug 1219275 Opened 9 years ago Closed 9 years ago

Session is not kept between reboots

Categories

(Firefox OS Graveyard :: Sync, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S10 (30Oct)

People

(Reporter: ferjm, Assigned: ferjm)

References

Details

(Keywords: regression, Whiteboard: [partner-cherry-pick])

Attachments

(1 file)

After a reboot with an already existing Sync session I see this on the logcat:

"Error trying sync unauthorized"
Blocks: fxos-sync
Severity: normal → critical
Flags: needinfo?(mbdejong)
Keywords: regression
Priority: -- → P1
Target Milestone: --- → FxOS-S10 (30Oct)
The 'unauthorized' error comes from the Sync app.
I see two problems:
* The IAC request not even reaching bootstrap.js. This is fixed when I put a delay at line 675 of tv_apps/smart-system/js/sync_manager.js, like this:

-      return this.iacRequest({
+      return new Promise(resolve => {
+        setTimeout(resolve, 10000);
+      }).then(() => {
+        return this.iacRequest({
[...]

* The unauthorized error. The only difference between the requests that are sent on boot and the ones that are sent during normal operation is that the BrowserID assertion of the failing ones sent on boot are 24 characters shorter. Do they have a wrong audience maybe?
Flags: needinfo?(mbdejong)
Confirmed: During boot, `this.settings.get('sync.fxa.audience')` is `undefined` instead of the desired `'https://token.services.mozilla.com/'`, on this line: https://github.com/mozilla-b2g/gaia/blob/master/tv_apps/smart-system/js/sync_manager.js#L565
Flags: needinfo?(ferjmoreno)
That, together with the fact that the sync app didn't start listening for the IAC request yet. Should be solvable with a setTimeout?
Thanks for looking into this.

(In reply to Michiel de Jong [:michielbdejong] from comment #3)
> Confirmed: During boot, `this.settings.get('sync.fxa.audience')` is
> `undefined` instead of the desired `'https://token.services.mozilla.com/'`,
> on this line:
> https://github.com/mozilla-b2g/gaia/blob/master/tv_apps/smart-system/js/
> sync_manager.js#L565

Ugh, we have to wait until having observed all the settings then.

(In reply to Michiel de Jong [:michielbdejong] from comment #4)
> That, together with the fact that the sync app didn't start listening for
> the IAC request yet. Should be solvable with a setTimeout?

This should be handled by the IAC API... I'll take a look.
Assignee: nobody → ferjmoreno
Flags: needinfo?(ferjmoreno)
(In reply to Fernando Jiménez Moreno [:ferjm] from comment #5)
> This should be handled by the IAC API... I'll take a look.

It didn't happen every time, and I also didn't find a pattern in it. But sometimes I saw error 'undefined' instead of 'unauth', and from my debug output it seems that https://github.com/mozilla-b2g/gaia/blob/master/apps/sync/js/bootstrap.js#L105 was not reached in those cases. When I added the timeout, it stopped happening (but the other error stayed).
Attachment #8680642 - Flags: review?(mbdejong)
Comment on attachment 8680642 [details] [review]
[gaia] ferjm:bug1219275.sync.session > mozilla-b2g:master

This still doesn't ensure that the sync app's bootstrap.js has been parsed and executed, maybe we should keep a follow-up bug open about that in case it becomes reproducible on other machines than mine.
Attachment #8680642 - Flags: review?(mbdejong) → review+
(In reply to Michiel de Jong [:michielbdejong] from comment #8)
> Comment on attachment 8680642 [details] [review]
> [gaia] ferjm:bug1219275.sync.session > mozilla-b2g:master
> 
> This still doesn't ensure that the sync app's bootstrap.js has been parsed
> and executed, maybe we should keep a follow-up bug open about that in case
> it becomes reproducible on other machines than mine.

Why do we need that?

The IAC API takes care of waiting for the connection handler to be set before delivering the message. If this is not happening, that's an IAC or System Messages API bug.
Flags: needinfo?(mbdejong)
https://github.com/mozilla-b2g/gaia/commit/6da0ea1cafac91057e6dcd0c7205f3dcdefcec6b
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
OK, tested again in master and could not reproduce it anymore. It was probably due to uncommitted changes I had in the sync app code.
Flags: needinfo?(mbdejong)
Whiteboard: [partner-cherry-pick]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: