[Bug 1057] New: RTT::os::Timer uses 100% cpu with no timers active on 32 bit linux

Dmytro Poplavskiy <[email protected]> Tue, 22 Jul 2014 00:31:14 +0200
Newsgroups gmane.science.robotics.orocos.devel
Message-ID <[email protected]/>
http://bugs.orocos.org/show_bug.cgi?id=1057

           Summary: RTT::os::Timer uses 100% cpu with no timers active on
                    32 bit linux
           Product: Toolchain
           Version: master
          Platform: All
        OS/Version: GNU/Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: RTT
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
   Estimated Hours: 0.0


When timer is started and killed on 32 bit linux,
RTT::os::Timer thread starts to use 100% CPU.

This is caused by requesting wait time too large to fit into 32 bit timespec.

Current Timer.cpp implementation:

// We can't use infinite as the OS may internally use time_spec, which can not
// represent as much in the future (until 2038) // XXX Year-2038 Bug
wake_up_time = (TimeService::InfiniteNSecs/4)-1;

While the comment is valid, the value used still does not fit the signed 32 bit
integer when converted to seconds,
so timespect value passed to sem_timedwait() has negative seconds time.

Changing this line to something like 
wake_up_time = 1000000000LL * (2147483647-1); //
std::numeric_limits<int32_t>::max()-1 seconds in nanosecond

fixes the issue.

-- 
Configure bugmail: http://bugs.orocos.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
You are the assignee for the bug.
-- 
Orocos-Dev mailing list
[email protected]
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev