Closed Bug 1056493 Opened 10 years ago Closed 10 years ago

[Dolphin][Hamachi][v1.4]No icons show for several seconds when back to homescreen from contacts

Categories

(Firefox OS Graveyard :: Gaia::System::Window Mgmt, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:1.4+, b2g-v1.4 fixed, b2g-v2.0 fixed, b2g-v2.1 fixed, b2g-v2.2 fixed)

RESOLVED FIXED
2.1 S3 (29aug)
blocking-b2g 1.4+
Tracking Status
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: yang.zhao, Assigned: lchang)

References

Details

Attachments

(3 files)

Attached image 2014-08-20-23-15-23.png
SRT:
1.Dolphin or Hamachi with v1.4
2.Push some data by using |./reference-workload/makeReferenceWorkload.sh| under monkey.test folder.
3.Make sure no apps are running in background
4.launch dialer app, then back to homescreen by clicking home button
5.launch sms app,then back to homescreen by clicking home button
6,launch contacts app,before all contacts are loaded,click home button to back to homescreen
After step 6, you'll see the homescreen shows no icons for several seconds, then back to normal.
Check the pid for homescreen, you'll see that there's no change in pid.
Check the log below,you'll see it takes a long time for homescreen to receive and handle visibilitychange event.

>Launch contacts app
08-20 01:20:45.781 E/GeckoConsole( 2313): Content JS LOG at app://system.gaiamobile.org/js/app_window.js:651 in aw__handle_mozbrowservisibilitychange: james->mozbrowservisibilitychange,app=Homescreen,type=background
>Press home button
08-20 01:20:46.591 E/GeckoConsole( 2313): Content JS LOG at app://system.gaiamobile.org/js/app_window_manager.js:409 in awm_handleEvent: james->##################################HOME button
>system receive mozbrowservisibilitychange event
08-20 01:20:47.661 E/GeckoConsole( 2313): Content JS LOG at app://system.gaiamobile.org/js/app_window.js:651 in aw__handle_mozbrowservisibilitychange: james->mozbrowservisibilitychange,app=Contacts,type=background
08-20 01:20:50.021 E/GeckoConsole( 2313): Content JS LOG at app://system.gaiamobile.org/js/app_window.js:651 in aw__handle_mozbrowservisibilitychange: james->mozbrowservisibilitychange,app=Homescreen,type=foreground
>homescreen receive visibilitychange background(homescreen->contacts)
08-20 01:20:50.161 E/GeckoConsole( 2369): Content JS LOG at app://homescreen.gaiamobile.org/js/homescreen.js:130 in mozVisChange: james->visibilitychange*****************,hidden=true
>homescreen receive visibilitychange foreground(contacts->homescreen)
08-20 01:20:50.171 E/GeckoConsole( 2369): Content JS LOG at app://homescreen.gaiamobile.org/js/homescreen.js:130 in mozVisChange: james->visibilitychange*****************,hidden=false
>repaint homescreen.It takes 4 sec from pressing home button to repaint homescreen
08-20 01:20:50.231 E/GeckoConsole( 2369): Content JS LOG at app://homescreen.gaiamobile.org/js/homescreen.js:137 in forceRepaint: james->begin toggle displayed

After oberserving the nice pid, it seems that the pid prority of homescreen doesn't change in time after pressing home button.
If I disable OOP for homescreen, the issue won't reproduce.

Could anyone can help on this issue?
[Blocking Requested - why for this release]:
blocking-b2g: --- → 1.4?
Flags: needinfo?(janjongboom)
Flags: needinfo?(ehung)
Could you give a more accurate number of "several" seconds?
Flags: needinfo?(ehung) → needinfo?(yang.zhao)
(In reply to Evelyn Hung [:evelyn] from comment #3)
> Could you give a more accurate number of "several" seconds?
Please see comment 1,it takes 4 secs. I also see sometimes it takes nearly 7 secs.
Flags: needinfo?(yang.zhao) → needinfo?(ehung)
The idea I had about this is that it happens because homescreen gets OOM, but if PID doesn't change then that's unlikely.
Flags: needinfo?(janjongboom)
It's not homescreen OOM, the pid doesn't change.
A simpler STR:
1. open dialer, then go back home
2. open contacts
3. press home button to go back home

It takes more than 5 sec to load homescreen icons. Luke is investigating.
@Luke, please update bug for your finding. Thanks.
Flags: needinfo?(ehung) → needinfo?(lchang)
(In reply to Evelyn Hung [:evelyn] from comment #7)
> A simpler STR:
> 1. open dialer, then go back home
> 2. open contacts
> 3. press home button to go back home
> 
> It takes more than 5 sec to load homescreen icons. Luke is investigating.
> @Luke, please update bug for your finding. Thanks.

BTW, other app combination is harder to reproduce the issue.
Thanks to Kan-Ru's profiling, we found that this issue might be caused by wrong priority value of communications' process.

In Gaia, for now, dialer and contacts are run in the same process (named "communications" in "b2g-info"). After doing the STR in comment 7, the priority ("nice" value) of communications process will become 0 (the highest priority) which is higher than homescreen process. Thus, homescreen will be not able to acquire enough resource to repaint itself if contact app is under heavy load (say, loading bulk photos).
Flags: needinfo?(lchang)
(In reply to Luke Chang [:lchang] from comment #9)
Yes,we also found that the priority of homescreen was not correct after pressing the home button.Could anyone can resolve this issue.This is a bad user experience, I think. Thank you.
Hi,Evelyn
    Could you tell me if this issue has any progress now? Per comment 9, it seems that this is not a gaia issue,right?
    Does anyone still work on this issue? Thank you!
Flags: needinfo?(ehung)
I am doing further investigation and will keep post.
Flags: needinfo?(ehung)
Update some findings about priority of communcations app.
When we launch SMS then back to homescreen, the priority manager is involved and the call stack as following:

#0  (anonymous namespace)::ParticularProcessPriorityManager::ComputePriority (this=0xa9621c50) at /home/dannyliang/work/codes/b2g_dolphin/gecko/dom/ipc/ProcessPriorityManager.cpp:911
#1  0xb53e4da2 in ResetPriorityNow (this=0xa9621c50) at /home/dannyliang/work/codes/b2g_dolphin/gecko/dom/ipc/ProcessPriorityManager.cpp:836
#2  (anonymous namespace)::ParticularProcessPriorityManager::Notify (this=0xa9621c50, aTimer=<optimized out>) at /home/dannyliang/work/codes/b2g_dolphin/gecko/dom/ipc/ProcessPriorityManager.cpp:859

In this case, ParticularProcessPriorityManager::ComputePriority() is called and it returns PROCESS_PRIORITY_FOREGROUND_HIGH due to there is wake lock by communication app. That's why we saw the nice value of communication app is 0 for a long time.

In my opinion, we might need to discuss if priority of application should be increased when wake lock is held.
Update more, this issue only happen when launch dialer then SMS. That's becasue this sequence caused "HasAppType("critical")" is true by Dialer and "mHoldsCPUWakeLock" is true by SMS.

ProcessPriority
ParticularProcessPriorityManager::ComputePriority()
{
  if ((mHoldsCPUWakeLock || mHoldsHighPriorityWakeLock) &&
      HasAppType("critical")) {
    return PROCESS_PRIORITY_FOREGROUND_HIGH;
  }
Update WIP patch in gecko side
(In reply to Danny Liang [:dliang] from comment #15)
> Created attachment 8478195 [details] [diff] [review]
> remove_wakelock_check_when_computer_priority.patch
> 
> Update WIP patch in gecko side

In my opinion, it's not good to increase priority by CPUWakeLock. This is just WIP and we might need more discussion for removing this CPUWakelock check. I don't know if any other design concern for this.
Gabriele, any insights there?
Flags: needinfo?(gsvelto)
Correct my TYPO on commemt 13 and comment 14, it should be CONTACTS, not SMS.
See Also: → 1046033
Attached file Pull Request 23304
According to Danny's finding in comment 14, we found that it's a regression of bug 907013. After that bug landed, we set "expecting-system-message" to all appWindow whether or not it really needs. This attribute causes "CPUWakeLock" in Gecko so we encountered this bug.

Since it's a regression, I prefer to fix it in Gaia first. However, there is still a chance that we made some mistakes in calculating priority. I suggest keeping discussing the issues that Danny mentioned in comment 16.


Hi Alive, Could you please help to take a look at this patch? Thanks.
Attachment #8478852 - Flags: review?(alive)
Assign to Luke, it's obviously a Gaia regression we need to fix anyway. (comment 19)

For Danny's question in comment 16, we can open a follow up bug to discuss if CPUWakeLock needs to be a reference when calculating priority. I feel it's a broader discussion on reviewing process priority, which we may not want to change it on 1.4 unless it causes other issues.
Assignee: nobody → lchang
Scratch my last comment about oom_score_adj values, I had a faulty build.
Comment on attachment 8478852 [details] [review]
Pull Request 23304

Could you also have a patch to master?
I think long term we are removing expect-system-message ...do we?
Attachment #8478852 - Flags: review?(alive) → review+
Hi Alive, 

Thanks for reviewing.

Regarding master branch, there is already a bug 1046033 which attempts to remove this attribute completely from both Gecko and Gaia. Since this bug didn't occur on master branch, I think we may just wait for that bug.
blocking-b2g: 1.4? → 1.4+
Blocks: 1059619
Comment on attachment 8478852 [details] [review]
Pull Request 23304

This patch seems to break the unit test. I'll fix it as soon as possible.
Target Milestone: --- → 2.1 S3 (29aug)
This needs to land on all branches even though there were no symptom on these devices.
Comment on attachment 8478852 [details] [review]
Pull Request 23304

[Approval Request Comment]
[Bug caused by] (feature/regressing bug #): Logic error in bug 907013
[User impact] if declined: OOM_ADJ score will be calculated incorrectly. No visible user impact on hi-mem device, but mid- and low-end device will act really quirky.
[Testing completed]: Already landed on v1.4.
[Risk to taking this patch] (and alternatives if risky): little code change; OOM_ADJ parameters might need readjustment after this patch lands.
[String changes made]: None
Attachment #8478852 - Flags: approval-gaia-v2.1?(fabrice)
Attachment #8478852 - Flags: approval-gaia-v2.0?(bbajaj)
Component: Gaia → Gaia::System::Window Mgmt
Attachment #8478852 - Flags: approval-gaia-v2.1?(fabrice) → approval-gaia-v2.1+
Attachment #8478852 - Flags: approval-gaia-v2.0?(bbajaj) → approval-gaia-v2.0+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: