Notice: We have migrated to GitLab launching 2024-05-01 see here:

#4179 reopened defect

libbsd select timeout issue

Reported by: Zhengxin Rui Owned by: Sebastian Huber <sebastian.huber@…>
Priority: normal Milestone:
Component: network/libbsd Version: 5
Severity: critical Keywords:
Cc: Blocked By:


Kernel put the select thread to sleep queue in sleepq_set_timeout_sbt,
the expire value is calculated by this
expire = (sbt - SBT_1S + sbt_per_tick - 1) / sbt_per_tick;
sbt is the absolute time,no time drift.
but the sbt_per_tick is not an accurate value,
it can make the expire vaule bigger and bigger while sbt is increasing.

In rtems_bsd_initialize function,
rtems_bsd_sbt_per_watchdog_tick = SBT_1S / tps;

In our system the tick rate is set to 1000Hz,
the real value of rtems_bsd_sbt_per_watchdog_tick is 1<<32/1000=4294967.296
but in integer type the value is 4294967.
The error is 0.296/4294967 = 0.069ppm,
and it can increase the expire value 1ms every 14000 seconds.

Attachments (1)

select.patch (1.4 KB) - added by Zhengxin Rui on 11/17/20 at 01:48:10.
using relative time for reference

Download all attachments as: .zip

Change History (3)

Changed on 11/17/20 at 01:48:10 by Zhengxin Rui

Attachment: select.patch added

using relative time for reference

comment:1 Changed on 03/04/21 at 08:08:27 by Sebastian Huber <sebastian.huber@…>

Owner: set to Sebastian Huber <sebastian.huber@…>
Resolution: fixed
Status: newclosed

In [changeset:"8fe59be236e7f2047adb6e393639bbf56bbd996d/rtems" 8fe59be/rtems]:

validation: Fix for 64-bit targets

Closes #4179.

comment:2 Changed on 03/04/21 at 08:10:54 by Sebastian Huber

Resolution: fixed
Status: closedreopened

Sorry, wrong number in commit.

Note: See TracTickets for help on using tickets.