Open Bug 862414 Opened 11 years ago Updated 2 years ago

MessageLoop::PostIdleTask never runs the task on Mac OS

Categories

(Core :: IPC, defect)

x86_64
macOS
defect

Tracking

()

People

(Reporter: justin.lebar+bug, Unassigned)

Details

Attachments

(1 file)

MessageLoop::PostIdleTask appears never to do anything.  I'll attach a simple testcase.

I'd appreciate some help bisecting this and understanding what's going on.
I'm surprised that anyone is using this API to begin with. When we hooked up the chromium event loop with the XPCOM event loop I doubt we took this into consideration. It will probably only fire the idle task when there is another (non-idle) task posted to that MessageLoop which wakes up the XPCOM event loop.

I really think we probably shouldn't use/should remove this API and instead stick what you need onto the normal XPCOM event/widget event loop processing.
Attached patch Silly testcaseSplinter Review
Apply this and start the browser.  You should get a big printf if the testcase works.
We use PostIdleTask in B2G to spawn a preallocated child process when the system is not busy processing.

Do you have a better way to accomplish the same thing?

It used to work -- I had a green mochitest to prove it -- so we may have regressed something recently.  Even if we stop using PostIdleTask, it's probably worthwhile understanding what broke in case it broke something else.
This blocks bug 844323 because (both before and after that bug, actually) we use PostIdleTask to start the preallocated process.  That bug adds a test which currently fails because of this bug.

We can change the test if this regression does not apply to B2G, but at the very least we need to understand what's going on here.

I do not know if this regression manifests on the b2g18 branch.
Blocks: 844323
> I'm surprised that anyone is using this API to begin with.

FWIW we appear to use this API in Fennec as well.  I have no idea if it's actually working there.

http://hg.mozilla.org/mozilla-central/file/50ab959f4bd1/widget/android/nsAppShell.cpp#l417
baku sees everything working fine.  So perhaps this is a mac issue.  (That would explain why I used to see it working; I had tested on Linux.)  Or otherwise perhaps we regressed this briefly, in which case updating my m-c clone should fix the problem.

I'll try updating and seeing what happens.
Okay, this apparently doesn't affect Linux.

This is great.  It means we're not blocking bug 844323 anymore, and it also means that the test coverage in that bug is sufficient to catch if PostIdleTask stops working.

I'll just disable the relevant test on Mac OS (and Windows, for good measure).

Let's leave this bug open for the fact that PostIdleTask doesn't work on Mac, granting bsmedberg's point that perhaps we shouldn't rely on this function at all.
No longer blocks: 844323
Summary: MessageLoop::PostIdleTask appears to be broken (never runs the task) → MessageLoop::PostIdleTask never runs the task on Mac OS
OS: All → Mac OS X
Hardware: All → x86_64
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: