Closed Bug 880931 Opened 11 years ago Closed 11 years ago

[unagi] Alarm doesn't sound under particular circumstances (see comment 18)

Categories

(Firefox OS Graveyard :: Gaia::Clock, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-b2g:leo+, b2g18 verified, b2g-v1.1hd fixed)

RESOLVED FIXED
blocking-b2g leo+
Tracking Status
b2g18 --- verified
b2g-v1.1hd --- fixed

People

(Reporter: ajones, Assigned: alive)

References

Details

(Keywords: regression, reproducible)

Attachments

(1 file)

I set my alarm for 6:30am then wake up about half an hour later. As soon as I unplug the USB charger from the phone the alarm sounds. This has happened twice this week on my Unagi phone.
This morning I woke up at 6am with the alarm set for 6:30am. At 6:40am I unplugged the USB charger and the alarm sounded immediately. An alarm that goes off after you wake up is not very useful.
blocking-b2g: --- → leo?
Summary: Alarm sounds after I wake up → Alarm doesn't sound until power cord is removed
Hi Anthony, 
Could you please provide the build version for the issue? Thank you.
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Build Identifier 20130603070207
Sounds like a regression as is,Anthony is this still reproducible ?
Adding qawanted to help test on a leo device with a recent build ?
Keywords: qawanted
It didn't happen this week but I'm using the same build. I've had spates of the alarm clock not working on the unagi. It has been hard to track down the exact pattern of failure. It's also hard to prove that the alarm clock has failed to alarm unless you are awake at the time.

It would be great if we could get more people using the alarm on the leo and see who arrives at work late.
This wfm on Leo with build from 20130613.  With usb charger plugged in and charging the device, the alarm sounded on time.
Keywords: qawanted
That has been my problem all along. It is working this week. It is just unreliable. However I have only just recently confirmed that pulling the USB cord out wakes it up.
Given that this problem is intermittent, is there a way we can automate the testing of the alarm function?
The symptom is like with Bug 866366. But Bug 866366 was already fixed and landed on v1-train at 0530(https://bugzilla.mozilla.org/show_bug.cgi?id=866366#c95). The issue should not be reproduced according to landing time stamp. We could keep to trace the issue and plan unit test for alarm function.
Yes. Sounds much the same. I can therefore confirm that it is not fixed in 20130613.
Anthony,
Do you mean that you are able to reproduce the issue on build version 20130613xxxxxxx?
Sorry. I meant it was broken on 20130603070207 as described in the other bug.
From the frequency of occurrence I would say that this is a regression introduced in 20130603070207 or soon before. It doesn't seem to happen when on battery. It may be related to the phone being fully charged.
I have a test on build version 20130617070209. I cannot reproduce the issue with reproduced rate 0/15. Will need QA's help on this.
Keywords: qawanted
This works for me on Leo device with:
Gecko  http://hg.mozilla.org/releases/mozilla-b2g18/rev/f1b84d841ced
Gaia   9dd0acc74c8e04218749917c85367a8080fa3cb1
BuildID 20130617070209
Version 18.0

This also wfm on unagi device with:
Gecko  http://hg.mozilla.org/releases/mozilla-b2g18/rev/a199b1109860
Gaia   3e9090894daaa1c7f894a1dcc1026b21f889eadc
BuildID 20130617230208
Version 18.0

I have tried with the battery fully charged, with battery charging, with device screen asleep, with device screen on, with device in airplane mode and not.  Each scenario works for me with 1.1.

Anthony, please try with the latest build.  Then, if you can reproduce, please provide more detailed STR's including any settings that might be involved here.
Flags: needinfo?(ajones)
Keywords: qawanted
leo+ as written, resolved/wfm based upon comment 15 though.
Status: NEW → RESOLVED
blocking-b2g: leo? → leo+
Closed: 11 years ago
Resolution: --- → WORKSFORME
Steps to reproduce:

* Plug phone into USB wall charger
* Turn off wifi and enable flight mode
* Set alarm for 1 minute in the future
* Turn phone screen off
* Wait for a minute

Expected results:

Alarm should sound.

Actual results:

Alarm does not sound until USB cable is removed or power button is pressed.
Flags: needinfo?(ajones)
Anthony, thank you for the clarification. I've figured out how to reproduce this:

1) Plug phone into a wall charger (not a computer)
2) Allow phone to charge completely (Unagi device shows green light)
3) Go to Settings and turn on Flight mode.
4) Set an alarm to go off soon
5) Ensure clock app is off (Press the home button then open Firefox)
6) turn off the phone screen
7) wait 'til the alarm is expected to sound

The alarm does not sound.  Wait another minute, then pull the usb cord out of the phone. I have experienced the alarm sounding when the cord is pulled and have also experienced no alarm. 

This was reproduced on Unagi with the build mentioned in comment 15.  I am  currently waiting for my Leo device to charge completely to have the exact required device state. Will get back here once that testing is complete.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Summary: Alarm doesn't sound until power cord is removed → Alarm doesn't sound under particular circumstances (see comment 18)
I can not reproduce this with Leo device:
Gecko  http://hg.mozilla.org/releases/mozilla-b2g18/rev/a199b1109860
Gaia   3e9090894daaa1c7f894a1dcc1026b21f889eadc
BuildID 20130617230208
Version 18.0
Summary: Alarm doesn't sound under particular circumstances (see comment 18) → [unagi] Alarm doesn't sound under particular circumstances (see comment 18)
Assignee: nobody → doliver
Keywords: reproducible
I'm looking on the issue. So, I take over it.

Gene,

Do you have any idea for the different charger source(USB wall charger or a computer)?
Assignee: doliver → iliu
(In reply to Tracy Walker [:tracy] from comment #18)
> Anthony, thank you for the clarification. I've figured out how to reproduce
> this:
> 
> 1) Plug phone into a wall charger (not a computer)
> 2) Allow phone to charge completely (Unagi device shows green light)
> 3) Go to Settings and turn on Flight mode.
> 4) Set an alarm to go off soon
> 5) Ensure clock app is off (Press the home button then open Firefox)
Would you means go back to home screen and launch Firefox browser app? Or long press home button and close Clock app via Cards view. Thank you.
The issue can be reproduced while device is charging via wall charger.

Reproduced steps:
* set an alarm at 17:26 with 2 minutes alarm later. It should goes off at 17:28:00.
 
Symptom:
* clock app receive system message at 17:28:00
* the process is sleeping between received system message and do window.open
* looks like requested an useless cpu wakelock while received system message 

Log:
======= receive system message on time ========
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:551 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler requested a cpuWakeLock time = 17:28:00
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:573 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler clearAlarmRequestId time = 17:28:00
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:594 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler setRepeatAlarm time = 17:28:00
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:603 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler find out which alarm is being fired time = 17:28:00
!!! process is sleeping !!!
....

======= unplug usb cord, then the process wakeup =======
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:627 in aac_gotAlarm: --> call window.open time = 17:31:04
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:631 in aac_gotAlarm: --> called window.open time = 17:31:04
I/IdleService( 2999): Remove idle observer 47e6ea30 (1 seconds)
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/onring.js:229 in anonymous: --> call RingView.init() time = 17:31:04
W/AudioFlinger(  120): Thread AudioOut_1 cannot connect to the power manager service
E/GeckoConsole( 3173): Content JS LOG at app://clock.gaiamobile.org/js/onring.js:42 in rv_init: --> init time = 17:31:04

Is it possible that module be able to unlock the cpu wakelock?
I haven't dig this too deep, but if this is only happened(failed cpu wake lock) when the device is wire-plugged, IMO should be something wrong in gecko..

(In reply to Ian Liu [:ianliu] from comment #22)
> The issue can be reproduced while device is charging via wall charger.
> 
> Reproduced steps:
> * set an alarm at 17:26 with 2 minutes alarm later. It should goes off at
> 17:28:00.
>  
> Symptom:
> * clock app receive system message at 17:28:00
> * the process is sleeping between received system message and do window.open
> * looks like requested an useless cpu wakelock while received system message 
> 
> Log:
> ======= receive system message on time ========
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/alarm.js:551 in aac_onAlarmFiredHandler: -->
> onAlarmFiredHandler requested a cpuWakeLock time = 17:28:00
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/alarm.js:573 in aac_onAlarmFiredHandler: -->
> onAlarmFiredHandler clearAlarmRequestId time = 17:28:00
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/alarm.js:594 in aac_onAlarmFiredHandler: -->
> onAlarmFiredHandler setRepeatAlarm time = 17:28:00
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/alarm.js:603 in aac_onAlarmFiredHandler: -->
> onAlarmFiredHandler find out which alarm is being fired time = 17:28:00
> !!! process is sleeping !!!
> ....
> 
> ======= unplug usb cord, then the process wakeup =======
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/alarm.js:627 in aac_gotAlarm: --> call
> window.open time = 17:31:04
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/alarm.js:631 in aac_gotAlarm: --> called
> window.open time = 17:31:04
> I/IdleService( 2999): Remove idle observer 47e6ea30 (1 seconds)
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/onring.js:229 in anonymous: --> call
> RingView.init() time = 17:31:04
> W/AudioFlinger(  120): Thread AudioOut_1 cannot connect to the power manager
> service
> E/GeckoConsole( 3173): Content JS LOG at
> app://clock.gaiamobile.org/js/onring.js:42 in rv_init: --> init time =
> 17:31:04
> 
> Is it possible that module be able to unlock the cpu wakelock?
My 2$:
Maybe the wakelock is canceled(by unlock() call) by somebody.
I have no idea if process A could cancel process B's cpu wake lock(No for screen wake lock case),
For system app, see https://github.com/mozilla-b2g/gaia/blob/v1-train/apps/system/js/screen_manager.js
Just reproduce the issue with different symptom.

Reproduced steps:
* set an alarm at 06:31 with 2 minutes alarm later. It should goes off at 06:33:00.
 
Symptom:
* clock app receive system message at 06:34:26 while unplug usb cord

Log:
======= receive system message not on time while unplug usb cord ========
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:542 in gotMessage: --> receive mozSetMessageHandler time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:552 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler requested a cpuWakeLock time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:574 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler clearAlarmRequestId time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:595 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler setRepeatAlarm time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:604 in aac_onAlarmFiredHandler: --> onAlarmFiredHandler find out which alarm is being fired time = 06:34:26
E/GeckoConsole( 1344): Content JS LOG at app://system.gaiamobile.org/js/window_manager.js:974 in setOrientationForApp: --> setOrientationForApp(): time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:628 in aac_gotAlarm: --> call window.open time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:632 in aac_gotAlarm: --> called window.open time = 06:34:26
W/AudioFlinger(  117): Thread AudioOut_1 cannot connect to the power manager service
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/onring.js:229 in anonymous: --> call RingView.init() time = 06:34:27
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/onring.js:42 in rv_init: --> init time = 06:34:27
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:634 in childWindowLoaded: --> unlockCpuWakeLock time = 06:34:26
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:561 in unlockCpuWakeLock: --> onAlarmFiredHandler check cpuWakeLock time = 06:34:27
E/GeckoConsole( 1558): Content JS LOG at app://clock.gaiamobile.org/js/alarm.js:563 in unlockCpuWakeLock: --> onAlarmFiredHandler unlock time = 06:34:27


In this case, looks like cpu wakelock mechanism does not work at gecko side. It will need platform devs for tracing the issue.
So, all the symptoms only happen under the scenario of wall charger?

USB wire is still working fine. Right?
(In reply to Gene Lian [:gene] from comment #26)
> So, all the symptoms only happen under the scenario of wall charger?
> 
> USB wire is still working fine. Right?

I could only reproduce when plugged into a wall charger. Plugged into computer, the alarm sounds as expected.
(In reply to Ian Liu [:ianliu] from comment #21)
> (In reply to Tracy Walker [:tracy] from comment #18)
> > 5) Ensure clock app is off (Press the home button then open Firefox)
> Would you means go back to home screen and launch Firefox browser app? Or
> long press home button and close Clock app via Cards view. Thank you.

Any method that ensures the clock app is not running should put the device in the reproducible state.  I could not reproduce this bug if the clock app was running at the time the device screen was put to sleep.
There seem to be a number of events that wake up the phone:

* USB activity (aside from power)
* Change in battery or charge state
* Wifi activity
* Pressuing the power button (not volume buttons)

I would guess that bluetooth and cellular activity would also wake up the phone. If none of these external influences wakes up the phone then the alarm doesn't sound.
Gene,

Unfortunately, I can reproduce the issue without any usb cord.(build version 20130619031222, m-c) The expected alarm will goes off with some delay time. Or goes off until device wake-up manually.
OK. I found the root cause. This is a regression due to the Gaia change at [1].

Why did you move the logic of checking the 'cpu' case?! The Gecko needs to depend on the dynamic value of |power.cpuSleepAllowed| to acquire/release the wake lock. This change would cause a horrible regression, which disables all the CPU wake locking mechanism no matter the CPU wake lock is being acquired/released from Gaia or Gecko.

[1] https://github.com/mozilla-b2g/gaia/commit/b2fcee447cbd3544a0f5a8d6430394dc5f18587b#apps/system/js/screen_manager.js
Assignee: iliu → alive
Depends on: 872430
Recover removed CPU wake lock code.
Attachment #765846 - Flags: review?(timdream)
Attachment #765846 - Flags: feedback?(iliu)
(In reply to Gene Lian [:gene] from comment #31)
> OK. I found the root cause. This is a regression due to the Gaia change at
> [1].
> 
> Why did you move the logic of checking the 'cpu' case?! The Gecko needs to
> depend on the dynamic value of |power.cpuSleepAllowed| to acquire/release
> the wake lock. This change would cause a horrible regression, which disables
> all the CPU wake locking mechanism no matter the CPU wake lock is being
> acquired/released from Gaia or Gecko.
> 
> [1]
> https://github.com/mozilla-b2g/gaia/commit/
> b2fcee447cbd3544a0f5a8d6430394dc5f18587b#apps/system/js/screen_manager.js

Yeah, it's my fault that doesn't review carefully. Thanks for pointing out.
Attachment #765846 - Flags: feedback?(gene.lian)
Comment on attachment 765846 [details]
https://github.com/mozilla-b2g/gaia/pull/10529

Looks good! Thanks you for the prompt help.
Attachment #765846 - Flags: feedback?(gene.lian) → feedback+
Comment on attachment 765846 [details]
https://github.com/mozilla-b2g/gaia/pull/10529

After applied the patch, I cannot reproduce it. It works for me. Thanks.
Attachment #765846 - Flags: feedback?(iliu) → feedback+
Blocks: 885676
Attachment #765846 - Flags: review?(timdream) → review+
master
https://github.com/mozilla-b2g/gaia/commit/f7cdb4e7edf909a41d2a2bbf03217e18cbf2b513
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
Uplifted f7cdb4e7edf909a41d2a2bbf03217e18cbf2b513 to:
v1-train: 6e5ba126023c8f4aa2f878d84d7b2f2385b342ab
1.1hd: 6e5ba126023c8f4aa2f878d84d7b2f2385b342ab
(In reply to Ian Liu [:ianliu] from comment #35)
> Comment on attachment 765846 [details]
> https://github.com/mozilla-b2g/gaia/pull/10529
> 
> After applied the patch, I cannot reproduce it. It works for me. Thanks.

Thanks Ian for all the verifications. :)
Issue no longer repros on the Leo.
Build ID: 20130717070237
Gecko: http://hg.mozilla.org/releases/mozilla-b2g18/rev/582e3a7018b0
Gaia: c506c50adaaebcf729ac3c27887ba2931ab79040
Platform Version: 18.1
Alarm worked as expected after applying the reproduce steps.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: