Opened 5 years ago

Closed 4 years ago

#7464 closed Bugs (fixed)

BOOST_TEST(n_alive == 1); fails due to race condition in a regression test tool

Reported by: greg.nowakowski@… Owned by: viboes
Milestone: Boost 1.53.0 Component: thread
Version: Boost 1.51.0 Severity: Regression
Keywords: thread, regression, race condition Cc: kurt.miller@…


This problem is at least from boost_1_50_0 Using gcc-4.1.2, but it has nothing to do with the bug. Platform Linux.

All libs/thread/test modules that test n_avail are having race condition which make cause regression test to fail here :

  void operator()()
    BOOST_TEST(alive_ == 1);
    BOOST_TEST(n_alive == 1); // race condition error
    op_run = true;


When the G() object is being passed, copy constructor is used to copy the object. Then boost::detail::thread_data<G>::run() is executed and G::operator()() called. If this operator is called before the main thread calls ~G(), n_avail may be 2. It is a very rare case to have the new thread execute operator()() before the main thread, and that is why it is so difficult to catch it.

Blessings, Greg.

Attachments (0)

Change History (3)

comment:1 Changed 4 years ago by viboes

  • Component changed from Regression Testing to thread
  • Owner changed from grafik to viboes
  • Status changed from new to assigned

comment:2 Changed 4 years ago by viboes

  • Milestone changed from To Be Determined to Boost 1.53.0

Changeset [82455] by viboes

comment:3 Changed 4 years ago by viboes

  • Resolution set to fixed
  • Status changed from assigned to closed

Committed revision [82491].

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain viboes.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.