Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Issue 873393004: [Windows] Fix for Browser IO MessageLoop spinning the CPU. (Closed)

Created:
5 years, 11 months ago by miu
Modified:
5 years, 11 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, sadrul, brucedawson, amineer, laforge
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Windows] Fix for Browser IO MessageLoop spinning the CPU. This corrects an integer overflow issue which resulted in the Browser IO MessageLoop spinning, eating up 100% of a CPU core. The conversion from a double to a 32-bit int was sometimes out-of-range: A large positive double value was being assigned as a negative int value. Because of this, MessagePumpWin acted as if a delayed task was past-due for running and refused to sleep the thread. Downstream code paths would instead see the task as "in the future" and then refuse to run it and remove it from the queue. This resulted in a "never-wait, never-dequeue" bad spinning state. While researching this problem, a number of code points have been exposed that are erroneously posting delayed tasks with huge delays, likely due to bad math on 64-bit platforms. Added DLOG warnings to whine at developers to avoid this in the future. See bug for additional details. BUG=450045 TBR=darin@chromium.org Committed: https://crrev.com/9caeaa287bca5d34a21d73d103b9af7fd3676936 Cr-Commit-Position: refs/heads/master@{#313238}

Patch Set 1 #

Patch Set 2 : Removed accidental two lines of white space. #

Patch Set 3 : Move constant out of platform-specific region of file. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+23 lines, -6 lines) Patch
M base/message_loop/message_loop.cc View 1 2 4 chunks +15 lines, -0 lines 1 comment Download
M base/message_loop/message_pump_win.cc View 1 2 chunks +8 lines, -6 lines 1 comment Download

Messages

Total messages: 11 (4 generated)
miu
PTAL. Due to the severity of the bug, I will likely commit TBR once the ...
5 years, 11 months ago (2015-01-27 04:20:54 UTC) #2
miu
On 2015/01/27 04:20:54, miu wrote: > PTAL. Due to the severity of the bug, I ...
5 years, 11 months ago (2015-01-27 06:35:06 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/873393004/40001
5 years, 11 months ago (2015-01-27 06:35:42 UTC) #7
commit-bot: I haz the power
Committed patchset #3 (id:40001)
5 years, 11 months ago (2015-01-27 06:43:43 UTC) #8
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/9caeaa287bca5d34a21d73d103b9af7fd3676936 Cr-Commit-Position: refs/heads/master@{#313238}
5 years, 11 months ago (2015-01-27 06:44:35 UTC) #9
darin (slow to review)
https://codereview.chromium.org/873393004/diff/40001/base/message_loop/message_loop.cc File base/message_loop/message_loop.cc (right): https://codereview.chromium.org/873393004/diff/40001/base/message_loop/message_loop.cc#newcode308 base/message_loop/message_loop.cc:308: incoming_task_queue_->AddToIncomingQueue(from_here, task, delay, false); would it be better to ...
5 years, 11 months ago (2015-01-27 07:52:39 UTC) #10
miu
5 years, 11 months ago (2015-01-27 19:19:46 UTC) #11
Message was sent while issue was closed.
Addressed these comments in follow-up change:
https://codereview.chromium.org/878033005/

I'll request code review once trybots (and local desktop) pass testing.


On 2015/01/27 07:52:39, darin wrote:
>
https://codereview.chromium.org/873393004/diff/40001/base/message_loop/messag...
> base/message_loop/message_loop.cc:308:
> incoming_task_queue_->AddToIncomingQueue(from_here, task, delay, false);
> would it be better to move this DLOG_IF to the implementation of
> AddToIncomingQueue instead? that way it can be done in one place instead of
two?

Done.  Good call, as this now warns callers of the MessageLoopProxy post task
methods.

>
https://codereview.chromium.org/873393004/diff/40001/base/message_loop/messag...
> base/message_loop/message_pump_win.cc:79: (timeout >
> std::numeric_limits<int>::max() ?
> you didn't want to use the max_int / 2 comparison here?

No.  The max_int / 2 is just a threshold for the warning logging (per discussion
in bug w/ scottmg@).  Here in MessagePumpWin, we're simply capping the wait time
to the largest value that can be represented within the type.

Powered by Google App Engine
This is Rietveld 408576698