Re: [Boost-bugs] [Boost C++ Libraries] #9662: High CPU usage for steady_clock waitable timer on Windows (integer overflow problem)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #9662: High CPU usage for steady_clock waitable timer on Windows (integer overflow problem)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-02-19 04:16:42


#9662: High CPU usage for steady_clock waitable timer on Windows (integer overflow
problem)
-------------------------+-------------------------------------------------
  Reporter: wyatt@… | Owner: chris_kohlhoff
      Type: Bugs | Status: new
 Milestone: To Be | Component: asio
  Determined | Severity: Showstopper
   Version: Boost | Keywords: asio, SetWaitableTimer,
  1.55.0 | basic_waitable_timer, steady_clock
Resolution: |
-------------------------+-------------------------------------------------
Changes (by wyatt@…):

 * severity: Problem => Showstopper

Comment:

 I've put together a simple example (see attached
 [https://svn.boost.org/trac/boost/attachment/ticket/9662/BoostMonotonicBug.zip
 BoostMonotonicBug.zip]). Just compile it & run it and you'll see the 100%
 CPU bug on a CPU core. '''This is a very serious bug.''' Anyone that
 accepts user-defined lengths of time that are then used in the
 basic_waitable_timer<steady_clock> will be affected by this 100% CPU bug.

 I'm going to dig into this bug further. But here's what I know so far:

 1. Small values like 30 seconds show no problem whatsoever. Everything
 just works with around 0% CPU.

 2. Some large values like 86400 seconds show 100% CPU usage immediately
 (whether it ever drops back down to 0% I don't know -- it certainly didn't
 with the hours of testing I've done so far).

 3. Some other large value like 43200 seconds show 0% CPU usage for a short
 time (around 2 hours), and then the CPU usage shoots up to 100%.



 Here's what I suspect, but haven't yet confirmed:

 1. This smells like an integer overflow or integer comparison bug.

 2. This seems like a Windows-only bug (I ran the example on Linux & Mac OS
 X and it was 0% CPU usage for the hour or so I ran the test).


 ----


 I have quite a bit of C++ experience, but not so much with the boost
 internals. If someone with experience with this particular implementation
 would spend an hour or 2 chatting with me we could solve this post-haste.

 I can certainly step through the boost implementation code line-by-line,
 but the process would be a good deal faster if I could chat with someone
 who knows this code already.

 At any rate, I'll continue to chip away at this problem.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9662#comment:1>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:15 UTC