Closed Bug 1144623 Opened 9 years ago Closed 9 years ago

[Shinano][Aries] Inconsistent WiFi state reported: connecting in statusbar, connected in Settings app

Categories

(Firefox OS Graveyard :: Wifi, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S8 (02Oct)

People

(Reporter: gerard-majax, Assigned: hchang)

References

Details

(Keywords: foxfood, polish)

Attachments

(5 files, 3 obsolete files)

Attached file wifi.log
STR:
 0. Try to connect to Mozilla Guest (or other networks)

Expected:
 Statusbar icon and Settings app status are in sync

Actual:
 Statusbar icon shows the "Connecting" animation, while Settings apps shows we are connected.

Trying to reach a webpage results in "No network" error reported.

> $ adb shell netcfg
> wlan0    UP                             169.254.174.135/16  0x00001043 00:90:4c:c5:12:38

So we have an IPv4 autoconfig address ...

I have observed a lot of strange states transition on Z3 and Z3 Compact, related to WiFi. Sometimes, I could get the same status (i.e., Settings saying we are connected, statusbar showing Connecting) but with a real IPv4 address on Mozilla Guest (or others).
And It's not a manifestation of the statusbar update issue tracked by :gmarty, since the whole statusbar is synced properly.
Attached file wifi2.log
Toggling airplane mode on/off, then retrying to connect, still failing according to statusbar, Settings app showing once Connected and then "Waiting for IP address".
Attached file wifi3.log
Same kind of steps with wifi.debugging.enabled and network.debugging.enabled prefs set to true.
Rebooting does not help.
Airplane mode does not help.
Settings the property "ro.moz.wifi.unloaddriver" does not help.
Forcing forgetting the network does not help.
Attached file dmesg_wifi.txt
Depends on: 1144637
So, that may be due to bug 1144637. I have flashed several devices with my pending PR for this one, including Etienne's device. If anyone wants to give a try to this too and confirm WiFi is no more flaky, that would be very useful.
Flags: needinfo?(mhenretty)
Flags: needinfo?(kgrandon)
Flags: needinfo?(etienne)
Flags: needinfo?(dietrich)
Flags: needinfo?(anygregor)
How do I flash with your changes to the shinano manifest repo to my z3c?
(In reply to Michael Henretty [:mhenretty] from comment #7)
> How do I flash with your changes to the shinano manifest repo to my z3c?

Apply to device/sony/shinano-common, then trash boot.img, system.img and root/ and system/ in out/target/product/aries/. Build and flash boot.img and system.img.

Current report from people who tested are that bug 1144637 does indeed improve things.
So it looks like this was tied to bug 1144637. So, just FTR, please make sure you flash boot and system partition to fix bug 1144637.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
Thanks Alex, will give this a test.
Flags: needinfo?(kgrandon)
(In reply to Alexandre LISSY :gerard-majax from comment #6)
> So, that may be due to bug 1144637. I have flashed several devices with my
> pending PR for this one, including Etienne's device. If anyone wants to give
> a try to this too and confirm WiFi is no more flaky, that would be very
> useful.

A day and 3 wifi networks later still no issues :)
Flags: needinfo?(etienne)
Flags: needinfo?(anygregor)
Thanks Alex!
Flags: needinfo?(mhenretty)
So the bad WiFi issue was fixed but there are still inconsistencies as confirmed by myself and others on bug 1154690 comment 20.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Yeah, I'm still seeing things like Wifi not autoconnecting in recent builds.
Flags: needinfo?(dietrich)
Can we check why ?
Flags: needinfo?(hchang)
I remember 'some' the of inconsistency issue are because the events reported by wpa_supplicant
are slightly different when switching network so that settings app incorrectly interprets the 
state of networks. It has been a long standing issue that the wifi event contains insufficient
information for gaia to update the status as far as I know.
Flags: needinfo?(hchang)
(In reply to Henry Chang [:henry] from comment #17)
> I remember 'some' the of inconsistency issue are because the events reported
> by wpa_supplicant
> are slightly different when switching network so that settings app
> incorrectly interprets the 
> state of networks. It has been a long standing issue that the wifi event
> contains insufficient
> information for gaia to update the status as far as I know.

By the way, the wifi state in the status bar seems always correct.
QA Whiteboard: [foxfood-triage]
Assignee: nobody → amchung
Dear Fred,
would you help me to review this patch?

Thanks!
Attachment #8634004 - Attachment is obsolete: true
Attachment #8640368 - Flags: review?(gasolin)
Comment on attachment 8640368 [details] [review]
added statement on isConnected function.

Thanks for providing patch!

Please fix and add some unit test on wifi_utils_test.js or the treeherder will fail

https://treeherder.mozilla.org/#/jobs?repo=gaia&revision=6100855939c17b5a050fa7b7c11d2efe54539437
Attachment #8640368 - Flags: review?(gasolin)
@amy if you need any help to finish the patch, please ping me. Or I can take it over and finish the unit test part.
Flags: needinfo?(amchung)
Fred, can you take this over if Amy doesn't have the time? Our wi-fi is pretty bad and it feels like it's only getting worse lately :( Let's try and land improvements like these in the 2.5 timeframe.
Flags: needinfo?(gasolin)
(In reply to Henry Chang [:henry] from comment #17)
> I remember 'some' the of inconsistency issue are because the events reported
> by wpa_supplicant
> are slightly different when switching network so that settings app
> incorrectly interprets the 
> state of networks. It has been a long standing issue that the wifi event
> contains insufficient
> information for gaia to update the status as far as I know.

Henry, can you please file a bug for what you are describing here? If the design of the API prevents us from having wifi that works correctly, we should not allow it to be unfixed for so long.

Wifi is a table-stakes feature - it *has* to work correctly or we cannot realistically expect people to use Firefox OS. If you know what is wrong, please jump quickly on making the change happen or working with others to do so :)
Flags: needinfo?(hchang)
(In reply to Dietrich Ayala (:dietrich) from comment #24)
> (In reply to Henry Chang [:henry] from comment #17)
> > I remember 'some' the of inconsistency issue are because the events reported
> > by wpa_supplicant
> > are slightly different when switching network so that settings app
> > incorrectly interprets the 
> > state of networks. It has been a long standing issue that the wifi event
> > contains insufficient
> > information for gaia to update the status as far as I know.
> 
> Henry, can you please file a bug for what you are describing here? If the
> design of the API prevents us from having wifi that works correctly, we
> should not allow it to be unfixed for so long.
> 
> Wifi is a table-stakes feature - it *has* to work correctly or we cannot
> realistically expect people to use Firefox OS. If you know what is wrong,
> please jump quickly on making the change happen or working with others to do
> so :)

Hi Dietrich,

You are right. I will discuss with current assignee and Fred to find out the 
best solution for this issue. Sorry for not taking care about this issue for 
a while :(
Flags: needinfo?(hchang)
I've made a patch with test cases, will discuss with Amy if we still need it before update the gecko wifi api.
Flags: needinfo?(gasolin)
Comment on attachment 8654725 [details] [review]
[gaia] gasolin:issue-1144623 > mozilla-b2g:master

@Amy @Evelyn could you help review this patch?
Attachment #8654725 - Flags: review?(ehung)
Attachment #8654725 - Flags: review?(amchung)
I am working on this bug and just got some idea.
This is my version of the patch. will discuss with Fred tmr.

https://github.com/mozilla-b2g/gaia/pull/31632/files
After investigation, the newly created item will be misjudged as 'connected'
in [1]. The reason behind is the function [2] has some issue:

1) We actually have a 'connected' property [3] and it does reflect the status 
   correctly but that's not enough for displaying like 'connecting' or 
   'obtaining an IP address'.

2) MozWifiManager.connection.network may have 'associated', 'connecting'
   other than just 'connected' state. It's hard to say if it makes sense
   from API's point of view. So I tend to keep the current design.

3) So, if we are still connecting with certain network, it will be considered
   as "connected" because of (2). It would also happen on other devices and 
   depends on when we are trying to create a wifi scan list. But why didn't we see the 
   similar issue on like flame? The answer is there may be a "status update event"
   followed by the scan result to update the list we created with state shown to
   mitigate the wrong created state.

Given the above findings, my solution is as simple as creating a scan result list
with the correct status by adding a function getNetworkStatus to WifiHelper.
The assumption behind is there would be at most one network with non-disconnected
status. 

[1] https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/js/modules/wifi_utils.js#L94
[2] https://github.com/mozilla-b2g/gaia/blob/master/shared/js/wifi_helper.js#L80
[2] http://hg.mozilla.org/mozilla-central/file/fb720c90eb49/dom/webidl/MozWifiManager.webidl#l67
Comment on attachment 8655340 [details] [review]
[gaia] elefant:bug/1144623-wifi-status > mozilla-b2g:master

Hi Fred,

Finally I got test case passed. Could you have a review on my patch? Thanks!
Attachment #8655340 - Flags: review?(gasolin)
Comment on attachment 8654725 [details] [review]
[gaia] gasolin:issue-1144623 > mozilla-b2g:master

remove the review sign since Henry have taken it. Thanks Henry!
Attachment #8654725 - Flags: review?(ehung)
Attachment #8654725 - Flags: review?(amchung)
Assignee: amchung → hchang
Comment on attachment 8655340 [details] [review]
[gaia] elefant:bug/1144623-wifi-status > mozilla-b2g:master

Though I'm not understand how the status really changed, the code and on device test seems fine to me.
Attachment #8655340 - Flags: review?(gasolin) → review+
Thanks for your review, Fred :)
Attachment #8640368 - Attachment is obsolete: true
Attachment #8654725 - Attachment is obsolete: true
Keywords: checkin-needed
https://github.com/mozilla-b2g/gaia/commit/fe5bd8f9a3dbef844eab1fe884a7637fff4d8bfd
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S8 (02Oct)
Depends on: 1227295
Flags: needinfo?(amchung)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: