Re: [Boost-bugs] [Boost C++ Libraries] #8323: boost::thread::try_join_for/try_join_until may block indefinitely due to a combination of problems in Boost.Thread and Boost.Chrono

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8323: boost::thread::try_join_for/try_join_until may block indefinitely due to a combination of problems in Boost.Thread and Boost.Chrono
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-03-30 11:47:44


#8323: boost::thread::try_join_for/try_join_until may block indefinitely due to a
combination of problems in Boost.Thread and Boost.Chrono
-----------------------------------------+----------------------------------
  Reporter: szakharchenko@… | Owner: viboes
      Type: Bugs | Status: assigned
 Milestone: To Be Determined | Component: thread
   Version: Boost 1.50.0 | Severity: Problem
Resolution: | Keywords: thread, chrono, steady_clock, try_jon_for, try_join_until, QueryPerformanceCounter
-----------------------------------------+----------------------------------

Comment (by szakharchenko@…):

 I've worked around my original problem, and can't offer more explanations
 or testing. I've attached a more deterministic testcase. In short,
 QueryPerformanceCounter isn't steady at least on some multicore
 processors, nor it should be, steady_clock isn't steady, but even when all
 of this will be fixed some moment in the future in Boost.Chrono,
 Boost.Thread will hang when told to try_join_until(now-exactly 1 msec)
 while any other moment in the past seems fine. So this is actually a
 combination of two problems, you may want to clone this ticket or
 something. I can reproduce it any day (you should be able too, with the
 attached testcase). Following is another stack trace.

 {{{

 Frame 0: boost::detail::timeout::remaining_milliseconds()
 thread_data.hpp Line 151
 is_sentinel must have returned true, going to return infinite wait time.
 this: {start=1714216 milliseconds=18446744073709551615 relative=true}

 Frame 1: boost::this_thread::interruptible_wait()
 thread.cpp Line 513
 using_timer: false
 handle_to_wait_for: 0x38 (OK)
 handle_count: 1
 wait_handle_index: 0
 interruption_index: ~0u
 handles: [0x38,0,0]
 timeout_index: ~0u

 Frame 2: boost::thread::try_join_until()
 thread.cpp Line 343
 local_thread_info: not null,thread_handle={handle_to_manage=0x00000038 }
 rel_time: {rep_=-1 } /* !!! */
 rel_time is calculated with a difference of the system clock measurements
 on line 342, so it could have run backwards there as well.

 Frame 3:
 boost::thread::try_join_until<Clock=steady>()
 thread.hpp Line 355
 t {d_={rep_=3089317882890 } }
 s_now {d_={rep_=130091140137592000 }
 c_now {d_={rep_=3089318990860 }

 t-c_now is 3089317882890-3089318990860 = -1107970, which gives a
 ceil<milliseconds> of -1.
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8323#comment:5>
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:12 UTC