Closed
Bug 1100863
Opened 10 years ago
Closed 8 years ago
SimplePush: Adaptive ping doesn't work when it converge
Categories
(Core :: DOM: Push Subscriptions, defect)
Core
DOM: Push Subscriptions
Tracking
()
People
(Reporter: frsela, Assigned: frsela)
Details
(Whiteboard: JIRA/OWD-37896)
Attachments
(1 file, 5 obsolete files)
4.85 KB,
patch
|
frsela
:
review+
frsela
:
feedback+
bajaj
:
approval-mozilla-b2g37+
|
Details | Diff | Splinter Review |
The adaptive ping of Push is not recalculated when it converges in a value and we change the time which Websocket can be open without transfers to other lower. We receive on logs the messages:
I/Gecko ( 210): -*- PushService.jsm: nextPingInterval=683437
I/Gecko ( 210): -*- PushService.jsm: lastGoodPing=1366875
But later, Push puts the keepalive timeout on 1366875:
I/Gecko ( 210): -*- PushService.jsm: Set alarm 1366875 in the future 554
Steps:
1.- Activate adaptive ping.
2.- Register an application on the Push Server.
3.- Wait to the adaptive ping converges in a value.
4.- Change the time which Websocket can be open without transfers to other lower.
5.- The keepalive timeout doesn't change when a ping isn't replied.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → frsela
Assignee | ||
Updated•10 years ago
|
Whiteboard: JIRA/OWD-37896
Assignee | ||
Comment 1•10 years ago
|
||
Jorge, please, test this possible patch.
Attachment #8524471 -
Flags: feedback?(jpruden92)
Comment 2•10 years ago
|
||
// Try the pingInterval at least 3 times, just to be sure that the
// calculated interval is not valid.
if (this._pingIntervalRetryTimes[lastTriedPingInterval] < 2) {
debug('pingInterval= ' + lastTriedPingInterval + ' tried only ' +
this._pingIntervalRetryTimes[lastTriedPingInterval] + ' times');
return;
}
Fernando, have you seen this trace? It is supposed to check at least 3 times (if I remember correctly) if a ping is valid or not.
Flags: needinfo?(frsela)
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Guillermo López :willyaranda from comment #2)
> // Try the pingInterval at least 3 times, just to be sure that the
> // calculated interval is not valid.
> if (this._pingIntervalRetryTimes[lastTriedPingInterval] < 2) {
> debug('pingInterval= ' + lastTriedPingInterval + ' tried only ' +
> this._pingIntervalRetryTimes[lastTriedPingInterval] + ' times');
> return;
> }
>
> Fernando, have you seen this trace? It is supposed to check at least 3 times
> (if I remember correctly) if a ping is valid or not.
Hi Willy !
Yes, but the problem appears when a valid ping interval is bellow the accepted gap. In that case, if the network changes and reduces that ping, the alghoritm doesn't re-start to recalculate it because _recalculatePing value. [1]
[1] http://mxr.mozilla.org/mozilla-central/source/dom/push/PushService.jsm#681
Flags: needinfo?(frsela)
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8524471 -
Attachment is obsolete: true
Attachment #8524471 -
Flags: feedback?(jpruden92)
Assignee | ||
Comment 5•10 years ago
|
||
Attachment #8547536 -
Flags: review?(nsm.nikhil)
Assignee | ||
Updated•10 years ago
|
Attachment #8533598 -
Attachment is obsolete: true
Comment on attachment 8547536 [details] [diff] [review]
Proposed patch
Review of attachment 8547536 [details] [diff] [review]:
-----------------------------------------------------------------
r- for the wrong ordering and duplicate calculation. Please post a new patch without all the other formatting changes. I'll review it immediately.
::: dom/push/PushService.jsm
@@ +143,4 @@
> index.get(aPushEndpoint).onsuccess = function setTxnResult(aEvent) {
> aTxn.result = aEvent.target.result;
> debug("Fetch successful " + aEvent.target.result);
> + };
Nit: Not needed.
@@ +162,4 @@
> aStore.get(aChannelID).onsuccess = function setTxnResult(aEvent) {
> aTxn.result = aEvent.target.result;
> debug("Fetch successful " + aEvent.target.result);
> + };
Ditto.
@@ +193,4 @@
> aTxn.result.push(cursor.value);
> cursor.continue();
> }
> + };
Actually, get rid of all of them :)
@@ +484,5 @@
> _upperLimit: 0,
>
> /**
> + * Count the times WebSocket goes down without receiving Pings
> + * so we can re-enable the ping recalculation alghoritm
Typo: algorithm.
@@ +686,4 @@
> return;
> }
>
> + if (!wsWentDown && this._wsWentDownCounter > 0) {
No need for the second part of the condition.
@@ +699,5 @@
> + this._wsWentDownCounter = 0;
> + this._recalculatePing = true;
> + this._lastGoodPingIntervals = 0;
> + }
> + debug('We do not need to recalculate the ping, based on previous data');
I don't understand why this block is needed when the websocket has NOT disconnected. If you want to check that a recalculation is required, you can move the block below to above this block so that we know a recalculation is required and so this block does not run and early return.
@@ +743,5 @@
>
> let nextPingInterval;
> let lastTriedPingInterval = prefs.get('pingInterval');
> +
> + if (!this._recalculatePing && wsWentDown) {
Do you really need the |!this._recalculatePing| condition, or can it be just |if (wsWentDown)| ?
If you need it, please add a comment explaining why.
@@ +744,5 @@
> let nextPingInterval;
> let lastTriedPingInterval = prefs.get('pingInterval');
> +
> + if (!this._recalculatePing && wsWentDown) {
> + debug('Deshabilitado el recalculo, incrementamos contador');
English :)
@@ +747,5 @@
> + if (!this._recalculatePing && wsWentDown) {
> + debug('Deshabilitado el recalculo, incrementamos contador');
> + this._wsWentDownCounter++;
> + if (this._wsWentDownCounter > kWS_MAX_WENTDOWN) {
> + debug('Ha fallado varias veces sin recibir datos, volvemos a iniciar el calculo de ping');
Here too.
@@ +750,5 @@
> + if (this._wsWentDownCounter > kWS_MAX_WENTDOWN) {
> + debug('Ha fallado varias veces sin recibir datos, volvemos a iniciar el calculo de ping');
> + this._wsWentDownCounter = 0;
> + this._lastGoodPingInterval = Math.floor(lastTriedPingInterval / 2);
> + nextPingInterval = this._lastGoodPingInterval;
This calculation is done lower in the same function (now renamed to _save()). Why does it need to be done here?
Attachment #8547536 -
Flags: review?(nsm.nikhil) → review-
Assignee | ||
Comment 7•10 years ago
|
||
Thank you Nikhil .... Reviewing your comments I realized that I upload an incorrect version of the patch (spanish WIP comments, and duplicated code ...) Sorry for the inconveniences.
I'll fix the correct patch taking into account your comments and re-upload it asap.
Regards
Assignee | ||
Comment 8•10 years ago
|
||
New version of the patch.
Before asking for review, I would like you to double-check if it's working properly.
Thanks in advance
Attachment #8547536 -
Attachment is obsolete: true
Attachment #8560401 -
Flags: feedback?(jpruden92)
Comment 9•10 years ago
|
||
Hello Fernando,
I have tested the patch and it works perfectly :-)
I put here some traces:
02-13 10:37:57.138 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 180000 in the future 56
180000
02-13 10:40:57.278 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 270000 in the future 58
270000
--> Adaptive ping changed to 200000
02-13 10:45:42.398 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 270000 in the future 61
270000
02-13 10:50:27.548 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 180000 in the future 64
180000
02-13 10:53:27.688 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 180000 in the future 66
180000
--> Adaptive ping changed to 100000
02-13 10:56:42.798 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 180000 in the future 69
180000
02-13 10:59:57.938 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 90000 in the future 72
90000
02-13 11:01:28.088 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 135000 in the future 74
135000
02-13 11:05:31.745 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 90000 in the future 76
90000
02-13 11:09:06.359 I/Gecko ( 1581): -*- PushService.jsm: Set alarm 90000 in the future 78
90000
Updated•10 years ago
|
Attachment #8560401 -
Flags: feedback?(jpruden92) → feedback+
Comment 10•10 years ago
|
||
Remember that we should change kWS_MAX_WENTDOWN to 2 or 3.
Assignee | ||
Comment 11•10 years ago
|
||
Thank you Jorge. As you suggested, I incremented kWS_MAX_WENTDOWN to 2.
Attachment #8560401 -
Attachment is obsolete: true
Attachment #8564123 -
Flags: review?(nsm.nikhil)
Attachment #8564123 -
Flags: feedback+
Comment on attachment 8564123 [details] [diff] [review]
Bug1100863_V2.patch
Review of attachment 8564123 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/push/PushService.jsm
@@ +736,5 @@
> let nextPingInterval;
> let lastTriedPingInterval = prefs.get('pingInterval');
> +
> + if (!this._recalculatePing && wsWentDown) {
> + debug('Websocket disconnected without ping adaptative alghoritm running');
algorithm
@@ +739,5 @@
> + if (!this._recalculatePing && wsWentDown) {
> + debug('Websocket disconnected without ping adaptative alghoritm running');
> + this._wsWentDownCounter++;
> + if (this._wsWentDownCounter > kWS_MAX_WENTDOWN) {
> + debug('Too many crashes. Reenabling ping adaptative algoritm');
s/crashes/disconnects.
@@ +742,5 @@
> + if (this._wsWentDownCounter > kWS_MAX_WENTDOWN) {
> + debug('Too many crashes. Reenabling ping adaptative algoritm');
> + this._wsWentDownCounter = 0;
> + this._recalculatePing = true;
> + this._lastGoodPingIntervals = 0;
This variable is not used anywhere. Please remove it.
Attachment #8564123 -
Flags: review?(nsm.nikhil) → review+
Assignee | ||
Comment 13•10 years ago
|
||
Thank you Nikhil.
Nits fixed
Attachment #8564123 -
Attachment is obsolete: true
Attachment #8564911 -
Flags: review+
Attachment #8564911 -
Flags: feedback+
Attachment #8564911 -
Flags: checkin?
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Assignee | ||
Updated•10 years ago
|
Attachment #8564911 -
Flags: checkin?
Comment 14•10 years ago
|
||
can we get a try run here ? thanks!
Flags: needinfo?(frsela)
Keywords: checkin-needed
Assignee | ||
Comment 15•10 years ago
|
||
(In reply to Carsten Book [:Tomcat] from comment #14)
> can we get a try run here ? thanks!
https://treeherder.mozilla.org/#/jobs?repo=try&revision=53437785df05
Flags: needinfo?(frsela)
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 16•10 years ago
|
||
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Assignee | ||
Comment 18•10 years ago
|
||
Comment on attachment 8564911 [details] [diff] [review]
Proposed patch V3
NOTE: Please see https://wiki.mozilla.org/Release_Management/B2G_Landing to better understand the B2G approval process and landings.
[Approval Request Comment]
Bug caused by (feature/regressing bug #): -
User impact if declined: Push server reconnections if carrier reduces the connection time
Testing completed: Y
Risk to taking this patch (and alternatives if risky): Low risk
String or UUID changes made by this patch: None
Attachment #8564911 -
Flags: approval-mozilla-b2g37?
Updated•10 years ago
|
Attachment #8564911 -
Flags: approval-mozilla-b2g37? → approval-mozilla-b2g37+
Comment 19•10 years ago
|
||
status-b2g-v2.2:
--- → fixed
status-b2g-master:
--- → fixed
status-firefox36:
--- → wontfix
status-firefox37:
--- → wontfix
Comment 20•9 years ago
|
||
url: https://hg.mozilla.org/integration/mozilla-inbound/rev/6379ad0797339835a87913fde9a30d458e64a241
changeset: 6379ad0797339835a87913fde9a30d458e64a241
user: Kit Cambridge <kcambridge@mozilla.com>
date: Tue Aug 11 07:30:38 2015 -0700
description:
Back out bug 1100863 and bug 1152264 for causing bug 1189729 on a CLOSED TREE. a=mhenretty,RyanVM
Updated•9 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 21•9 years ago
|
||
Does something need to land on v2.2 here still? AFAICT, this was only ever backed out from trunk.
Comment 22•8 years ago
|
||
Closing this out because the patch was backed out from Simple Push, and Web Push doesn't use adaptive pings.
Status: REOPENED → RESOLVED
Closed: 10 years ago → 8 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•