Opened 9 years ago
Closed 9 years ago
#8960 closed Bugs (wontfix)
condition_wariable::wait_for throws exception (with Invalid argument), if system date/time < 1970
Reported by: | anonymous | Owned by: | viboes |
---|---|---|---|
Milestone: | To Be Determined | Component: | thread |
Version: | Boost 1.53.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Linux, kernel 2.6.32, arm-none-linux-gnueabi-g++ 2010q1
Change History (8)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Component: | None → thread |
---|---|
Owner: | set to |
Status: | new → assigned |
comment:3 by , 9 years ago
The example works fine for me on trunk. Could you try the trunk or the lasr 1.54 version?
comment:4 by , 9 years ago
have some problems to reproduce, because busybox applet 'date' has builtin value check, and set system date to any value < 01-01-1970 is currently impossible.
this issue caused on development board (D2-plug,http://www.globalscaletechnologies.com/t-d2plugdetails.aspx)
I don't know about a reason, but 3 days ago system time was changed to May 1948. (rtc chip, or something else - i don't know). Then i catched exceptions on condition_variables. Then long time debugging, and i find reason of EINVAL of pthread_cond_timed_wait: bad value of timespec (big negative value of tv_sec), which is result of this code (pthread/condition_variable.hpp):
template <class lock_type, class Clock, class Duration> cv_status wait_until( lock_type& lock, const chrono::time_point<Clock, Duration>& t) { using namespace chrono; system_clock::time_point s_now = system_clock::now(); typename Clock::time_point c_now = Clock::now(); wait_until(lock, s_now + ceil<nanoseconds>(t - c_now)); return Clock::now() < t ? cv_status::no_timeout : cv_status::timeout; }
and one notice: exceptions throws only in child threads. condvars in main thread workes fine.
now i correct system time to 2013, and all is ok.
if you tell me easy way to set up May 1948 - i'm ready for any tests.
(sorry for my english) Alexey.
comment:5 by , 9 years ago
I suspect that I can not do anything for this case, if pthread_cond_timed_wait doesn't supports times before 01-01-1970.
What do you suggest?
comment:6 by , 9 years ago
I suggest: check for negative timespec::tv_sec and throw different exception, than "phread_cond_timed_wait: EINVAL"
debug of this issue may be not simple, if boost::condition_variable::wait_for do not called directly. In my case - exception throws from boost::this_thread::sleep_for (in child threads). And code was absolutely not ready for this surprise.
comment:7 by , 9 years ago
I don't know if it is worth including this on the library.
You could do this kind of test yourself. You can wrap the sleep_for call and do the test there.
comment:8 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
example: