Closed Bug 1005775 Opened 10 years ago Closed 10 years ago

[Wifi] [Follow up of Bug 999388]Refactor wifi when send terminate command to wpa_supplicant

Categories

(Firefox OS Graveyard :: Wifi, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:1.4+, firefox30 wontfix, firefox31 wontfix, firefox32 fixed, b2g-v1.4 fixed, b2g-v2.0 fixed)

RESOLVED FIXED
2.0 S2 (23may)
blocking-b2g 1.4+
Tracking Status
firefox30 --- wontfix
firefox31 --- wontfix
firefox32 --- fixed
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed

People

(Reporter: vchang, Assigned: vchang)

References

Details

(Keywords: crash, verifyme, Whiteboard: [b2g-crash][caf-crash 206][caf priority: p1][CR 662122][p=2])

Attachments

(1 file, 1 obsolete file)

This is found in Tarako platfrom that CTRL-EVENT-TERMINATING event may not send from wpa_supplicant if stop supplicant command is sent right after sending terminate wpa_supplicant command. 

The terminate command response from the supplicant doesn't mean that supplicant is terminated successfully. Instead of that, we should wait CTRL-EVENT-TERMINATING from event thread, and stop and close supplicant there.
Assignee: nobody → vchang
Whiteboard: [p=2]
Target Milestone: --- → 2.0 S1 (9may)
Attached patch Patch v1.0 (obsolete) — Splinter Review
Attachment #8417816 - Flags: review?(chulee)
Comment on attachment 8417816 [details] [diff] [review]
Patch v1.0

Review of attachment 8417816 [details] [diff] [review]:
-----------------------------------------------------------------

The concept looks good to me, I think there might be a timing issue to resolve.

::: dom/wifi/WifiWorker.js
@@ +849,5 @@
> +      waitForTerminateEventTimer.cancel();
> +      waitForTerminateEventTimer = null;
> +    }
> +  };
> +  function createWaitForTerminateEventTimer(onTimeout) {

If we only accept one timer at a time, we need to check if |waitForTerminateEventTimer| is already created before.
If |waitForTerminateEventTimer| is not null, we need to cancel previous timer or ignore this call.

@@ +959,5 @@
>        // until it does.
>        manager.state = "DISABLING";
>        wifiCommand.terminateSupplicant(function (ok) {
>          manager.connectionDropped(function () {
> +          manager.stopSupplicantCallback = (function () {

|manager.connectionDropped()| have function calls to netutil which might takes long time, and if "CTRL-EVEN-TERMINATING" is received before |manager.stopSupplicantCallback()| and |createWaitForTerminateEventTimer()| are set, we have to wait 2 seconds for timer to trigger it.

This won't happen now, but might happen if we land bug 994564.

I think it's better set |manager.stopSupplicantCallback()| before calling |terminateSupplicant()|.

@@ +972,5 @@
> +          }).bind(this);
> +          let terminateEventCallback = (function() {
> +            handleEvent("CTRL-EVENT-TERMINATING");
> +          }).bind(this);
> +          createWaitForTerminateEventTimer(terminateEventCallback);

As mentioned above, timer might be created in the middle of |manager.stopSupplicantCallback()|, and we will get two "CTRL-EVENT-TERMINATING" events.
Although it seems second event won't do any harm to us, it would be better if we can prevent create an unnecessary timer here.

Maybe only create timer if |manager.stopSupplicantCallback| is not null, and we can set |manager.stopSupplicantCallback| to null earlier in |handleEvent{}| by

if (manager.stopSupplicantCallback) {
  cancelWaitForTerminateEventTimer();
  let stopSupplicantCallback = manager.stopSupplicantCallback.bind(manager);
  manager.stopSupplicantCallback = null;
  stopSupplicantCallback();
  stopSupplicantCallback = null;
}

Not sure if worth it though.
Attachment #8417816 - Flags: review?(chulee) → feedback+
blocking-b2g: --- → backlog
Address the review comments.
Attachment #8417816 - Attachment is obsolete: true
Attachment #8420021 - Flags: review?(chulee)
Comment on attachment 8420021 [details] [diff] [review]
Patch v1.1 for mc

Review of attachment 8420021 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, but I think it's better to wait for more feedback from bug 1007766 before landing this.
Attachment #8420021 - Flags: review?(chulee) → review+
Greg,

Appreciate your effort testing this patch.

Please check if bug 1007766 and bug 1001897 are fixed with the patch.
Flags: needinfo?(ggrisco)
Keywords: verifyme
I'm still waiting for test results, will report back here once I have the info.
Nominate for 1.4+, see comment 32 in bug 1007766.
blocking-b2g: backlog → 1.4?
We haven't seen the crash with this signature reproduce since applying the patch:

[@ wpa_ctrl_recv | wifi_ctrl_recv | wifi_wait_on_socket | ICSWpaSupplicantImpl::do_wifi_wait_for_event(char const*, char*, unsigned int) ]
Flags: needinfo?(ggrisco)
Whiteboard: [p=2] → [CR 662122][p=2]
Blocks: 1001897
1.4+
blocking-b2g: 1.4? → 1.4+
No longer blocks: 1001897
https://hg.mozilla.org/mozilla-central/rev/f638c7fb76d1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Crash observed on: 

Device: msm8226
Gonk Version: AU_LINUX_GECKO_B2G_KK_3.5.01.04.00.113.091
Moz BuildID: 20140505000201
B2G Version: 1.4
Gecko Version: 30.0
Gaia:  http://git.mozilla.org/?p=releases/gaia.git;a=commit;h=fccb15d6940db51615545574877a62d69406b1c2
Gecko: http://git.mozilla.org/?p=releases/gecko.git;a=commit;h=3ed3bbf1941e608bc9630942c7063a8b818f36bc
Crash observed on: 

Device: msm8226
Gonk Version: AU_LINUX_GECKO_B2G_KK_3.5.01.04.00.113.091
Moz BuildID: 20140505000201
B2G Version: 1.4
Gecko Version: 30.0
Gaia:  http://git.mozilla.org/?p=releases/gaia.git;a=commit;h=fccb15d6940db51615545574877a62d69406b1c2
Gecko: http://git.mozilla.org/?p=releases/gecko.git;a=commit;h=3ed3bbf1941e608bc9630942c7063a8b818f36bc
please ignore comments 15 and 16.
Crash observed on: 

Device: msm8226
Gonk Version: AU_LINUX_GECKO_B2G_KK_3.5.01.04.00.113.091
Moz BuildID: 20140505000201
B2G Version: 1.4
Gecko Version: 30.0
Gaia:  http://git.mozilla.org/?p=releases/gaia.git;a=commit;h=fccb15d6940db51615545574877a62d69406b1c2
Gecko: http://git.mozilla.org/?p=releases/gecko.git;a=commit;h=3ed3bbf1941e608bc9630942c7063a8b818f36bc
(In reply to Greg Grisco from comment #17)
> please ignore comments 15 and 16.

Comment 18 too, then, I assume?
Whiteboard: [CR 662122][p=2] → [caf priority: p1][CR 662122][p=2]
Whiteboard: [caf priority: p1][CR 662122][p=2] → [b2g-crash][caf-crash 206][caf priority: p1][CR 662122][p=2]
Keywords: crash
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: