Subject: [Boost-bugs] [Boost C++ Libraries] #11158: Pthread thread deadlock when faketime used
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-03-31 07:23:50
#11158: Pthread thread deadlock when faketime used
------------------------------+----------------------
Reporter: slobodyanukma@⦠| Owner: anthonyw
Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
Version: Boost 1.55.0 | Severity: Problem
Keywords: |
------------------------------+----------------------
Following code deadlocked on pthread_cond_timedwait call if started
like
{{{
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
FAKETIME="+30d" ./a.out
}}}
{{{
#include <boost/thread.hpp>
#include <iostream>
using namespace std;
void f() {
int n=50;
while (n--) {
cout << n << endl;
boost::this_thread::sleep(boost::posix_time::seconds(1));
// boost::this_thread::sleep_for( boost::chrono::seconds(1)
);
// sleep(1);
}
}
int main(int argc, char* argv[]) {
boost::thread th(f);
th.join();
return 0;
}
}}}
Here is backtarce:
{{{
#0 pthread_cond_timedwait@@GLIBC_2.3.2 () at
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1 0x0000000000da8ed3 in
boost::condition_variable::do_wait_until(boost::unique_lock<boost::mutex>&,
timespec const&) ()
#2 0x0000000000da792f in boost::this_thread::hiden::sleep_until(timespec
const&) ()
#3 0x0000000000978ff6 in boost::this_thread::sleep (abs_time=...) at
/home/sl/project/Elephantdrive/devroot/3rdparty/boost/boost/thread/pthread/thread_data.hpp:249
#4 0x0000000000979065 in
boost::this_thread::sleep<boost::posix_time::seconds> (rel_time=...) at
/home/sl/project/Elephantdrive/devroot/3rdparty/boost/boost/thread/pthread/thread_data.hpp:255
}}}
But no deadlocks if used sleep(1) instead. I belive it is some
pthread_cond_timedwait issue but will be good call sleep() or usleep() in
boost's internals instead in according points if possible.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11158> 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:18 UTC