Closed
Bug 1206163
Opened 9 years ago
Closed 9 years ago
Retry failed register requests
Categories
(Core :: DOM: Push Subscriptions, defect)
Core
DOM: Push Subscriptions
Tracking
()
RESOLVED
FIXED
mozilla44
People
(Reporter: lina, Assigned: lina)
Details
Attachments
(1 file, 1 obsolete file)
16.55 KB,
patch
|
dragana
:
review+
|
Details | Diff | Splinter Review |
Currently, if the connection to the Push service fails, we reject all pending requests with an `AbortError`. Instead, we should keep those requests around and retry after reconnecting.
Assignee | ||
Comment 1•9 years ago
|
||
That should be "pending register requests." The WebSocket client code don't track other requests.
Assignee | ||
Updated•9 years ago
|
Summary: Retry failed requests → Retry failed register requests
Assignee | ||
Comment 2•9 years ago
|
||
Dragana, could you have a look at this, please? This changes the queuing logic for outgoing WebSocket requests.
Attachment #8664554 -
Flags: review?(dd.mozilla)
Comment 3•9 years ago
|
||
Comment on attachment 8664554 [details] [diff] [review] 0001-Bug-1206163-Send-unacknowledged-register-requests-on.patch Review of attachment 8664554 [details] [diff] [review]: ----------------------------------------------------------------- This need a bit rewriting. Maybe also add a test for the case that will not work with this patch. I think we do not have such a test. "The socket is connected and a registration is requested" ::: dom/push/PushServiceWebSocket.jsm @@ +990,5 @@ > resolve: resolve, > reject: reject, > ctime: Date.now() > }; > this._queueRequest(data); instead of: if (data.messageType != "register") in _queueRequest, you could just delete this line here. But anyway this needs to be rewritten, see below. @@ +1046,2 @@ > _queueRequest(data) { > + if (data.messageType != "register") { this is not going to work. It is only working if socket is not connected when request arrives, i.e. if finishHandShake is called. It probably should be: if (data.messageType != "register" || this._currentState == STATE_READY) { maybe nicer: if (this._currentState != STATE_READY && !this._notifyRequestQueue) { let promise = new Promise((resolve, reject) => { this._notifyRequestQueue = resolve; }); this._enqueue(_ => promise); } if (data.messageType != "register" || this._currentState == STATE_READY) { this._enqueue(_ => this._send(data)); } But still with this it can happen that we send request twice :)
Attachment #8664554 -
Flags: review?(dd.mozilla) → review-
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Dragana Damjanovic [:dragana] from comment #3) > Comment on attachment 8664554 [details] [diff] [review] > 0001-Bug-1206163-Send-unacknowledged-register-requests-on.patch > > Review of attachment 8664554 [details] [diff] [review]: > ----------------------------------------------------------------- > > This need a bit rewriting. Maybe also add a test for the case that will not > work with this patch. I think we do not have such a test. "The socket is > connected and a registration is requested" Oops, thanks for catching that! Ben and I extended `test_reconnect_retry.js` to send a second register after reconnect. The latest patch also calls `this._send(data)` directly, though I can change that to `this._enqueue(_ => this._send(data))` if you'd like.
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8664554 -
Attachment is obsolete: true
Attachment #8667100 -
Flags: review?(dd.mozilla)
Comment 6•9 years ago
|
||
Comment on attachment 8667100 [details] [diff] [review] 0001-Bug-1206163-Send-unacknowledged-register-requests-on.patch Review of attachment 8667100 [details] [diff] [review]: ----------------------------------------------------------------- With this implementation it can happen that some register request are sent 2 time, we are ok with this extra work on the server. The channelId will be the same for 2 requests. The solution could be to enqueue request and only to add them to the requestQueue just before they are sent, but this is extra work so if we are ok from server side to get some, probably very rare, duplicate request we do not need this change.
Assignee | ||
Comment 7•9 years ago
|
||
(In reply to Dragana Damjanovic [:dragana] from comment #6) > With this implementation it can happen that some register request are sent 2 > time, we are ok with this extra work on the server. The channelId will be > the same for 2 requests. Not sure I follow. Is this the case where the server handles the register request, but the connection is dropped before it can reply?
Status: NEW → ASSIGNED
Comment 8•9 years ago
|
||
(In reply to Kit Cambridge [:kitcambridge] (PTO from 2015-10-06 to 2015-10-16) from comment #7) > (In reply to Dragana Damjanovic [:dragana] from comment #6) > > With this implementation it can happen that some register request are sent 2 > > time, we are ok with this extra work on the server. The channelId will be > > the same for 2 requests. > > Not sure I follow. Is this the case where the server handles the register > request, but the connection is dropped before it can reply? STATE_READY is set before the requests in the requestQueue are queued for re-registering. For the incoming register requests between setting STATE_READY and putting the re-requestions into a queue, the register requests will be sent 2 times. It is possible to solve this by generating and setting channelid just before send, so that it is possible to distinguish the requests that needs to be resent and the new coming requests. So this is not big of a deal, you can decide if you want to fix it.
Updated•9 years ago
|
Attachment #8667100 -
Flags: review?(dd.mozilla) → review+
Assignee | ||
Comment 9•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=8ab9802c0a6c
Assignee | ||
Comment 10•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/32c3f77b40671d80e6fcbcedf7f6b69c6e5c7121 Bug 1206163 - Retry failed register requests on reconnect. r=dragana
https://hg.mozilla.org/mozilla-central/rev/32c3f77b4067
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in
before you can comment on or make changes to this bug.
Description
•