[push] Once UDP socket is closed, it is not open for listening again

RESOLVED FIXED in Firefox 26

Status

()

defect
RESOLVED FIXED
6 years ago
5 years ago

People

(Reporter: willyaranda, Assigned: nsm)

Tracking

Trunk
mozilla26
x86
macOS
Points:
---

Firefox Tracking Flags

(blocking-b2g:leo+, firefox24 wontfix, firefox25 wontfix, firefox26 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 wontfix, b2g-v1.1hd fixed)

Details

Attachments

(1 attachment, 1 obsolete attachment)

STR:
 1. Start 3G, so UDP kicks in. We are able to send UDP notifications for wakeup.
 2. Start wifi, so the "network-active-changed" is fired. The UDP socket is closed (but not nullyfied).
 3. If we connect 3G again, we can be woken up, so UDP should start listening again, but it is checked |if (this._udpServer)| which means that if the object exists not if it's listening or not, so it is not started again.

Logs:
08-01 11:52:43.440 I/Gecko   (  108): -*- PushService.jsm: wsOnServerClose() 4774 UDP Wakeup
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: Server closed with promise to wake up
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: listenForUDPWakeup()
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: getNetworkState()
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: Running on mobile data
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: listenForUDPWakeup listening on 2442
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: wsOnStop()
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: shutdownWS()
08-01 11:52:43.450 I/Gecko   (  108): -*- PushService.jsm: Stopped existing alarm 3
<-- mine 08-01 11:58:48.666 I/Gecko   (  108): -*- PushService.jsm: close udp
08-01 11:58:48.666 I/Gecko   (  108): -*- PushService.jsm: shutdownWS()
08-01 11:58:48.666 I/Gecko   (  108): -*- PushService.jsm: getAllChannelIDs()
08-01 11:58:48.706 I/Gecko   (  108): -*- PushService.jsm: UDP Server socket was shutdown. Status: 2152398850



08-01 11:58:59.697 I/Gecko   (  108): -*- PushService.jsm: wsOnServerClose() 4774 UDP Wakeup
08-01 11:58:59.697 I/Gecko   (  108): -*- PushService.jsm: Server closed with promise to wake up
08-01 11:58:59.697 I/Gecko   (  108): -*- PushService.jsm: listenForUDPWakeup()
08-01 11:58:59.697 I/Gecko   (  108): -*- PushService.jsm: UDP Server already running
08-01 11:58:59.737 I/Gecko   (  108): -*- PushService.jsm: wsOnStop()
08-01 11:58:59.737 I/Gecko   (  108): -*- PushService.jsm: shutdownWS()
Summary: [push] Once UDP socket is closed, it is not possible to connect again → [push] Once UDP socket is closed, it is not open for listening again
Component: General → DOM: Push Notifications
Product: Boot2Gecko → Core
Version: unspecified → Trunk
Hey Nikhil,

I don't know what should be the best option here, if nullify the UDP server when we close the listening or override again the initialization of the object.
Flags: needinfo?(nsm.nikhil)
Noming to leo as it is closely related with 896919
blocking-b2g: --- → leo?
dougt, do you know what a typical impacted use case might look like for this and bug 896919?
Flags: needinfo?(doug.turner)
This should fix it. I've selected the reset on close option since
that prevents multiple calls to listenForUDPWakeup() from resetting the socket when we don't want it to.
Attachment #786044 - Flags: review?(doug.turner)
Assignee: nobody → nsm.nikhil
Flags: needinfo?(nsm.nikhil)
Comment on attachment 786044 [details] [diff] [review]
Reset UDP socket to allow re-initialization.

why not null instead, like _db?
without this patch, a phone will have a tough time getting woken up via UDP the second time.

nsm, follow up bug to add some unit tests please.  No need to couple that to this.
blocking-b2g: leo? → leo+
Flags: needinfo?(doug.turner)
Comment on attachment 786044 [details] [diff] [review]
Reset UDP socket to allow re-initialization.

Tested. This works (with undefined, not with null)
Attachment #786044 - Flags: feedback?(willyaranda) → feedback+
(I mean that I tested with undefined, not with null, but that should work also)
Attachment #786044 - Attachment is obsolete: true
Attachment #786044 - Flags: review?(doug.turner)
Flags: needinfo?(doug.turner)
Comment on attachment 786345 [details] [diff] [review]
Reset UDP socket to allow re-initialization.

go go go
Attachment #786345 - Flags: review?(doug.turner) → review+
Flags: needinfo?(doug.turner)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6dc503243056
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.