eclipse-iceoryx / eclipse-iceoryx/iceoryx

'adaptive_wait' has spurious wakeups on Windows

Open
#2,161 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2.2k
Forks
492
Avg merge
18h 57m
Merged PRs (30d)
1

Description

## Brief feature description

`adaptive_wait` uses `std::his_thread::sleep_for(INITIAL_WAITING_TIME)` with 100µs for `INITIAL_WAITING_TIME` as second stage in the waiting strategy. This is done for around 10000 iterations before switching to the final waiting strategy with 10ms steps. On Windows this might result in immediate wakeups and a higher CPU load.

## Potential fix

In order to fix the problem `nanosleep` could be used but unfortunately this is not available on Windows and it is pretty hard to reliably achieve sleep times below 1ms. There are a few option which can be explored
- https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-sleepex
- https://learn.microsoft.com/en-us/windows/win32/sync/using-waitable-timer-objects
- https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-setwaitabletimer

Contributor guide

Open the contributing guide

Research direction

Start by locating the adaptive_wait implementation and its Windows waiting path, then reproduce the 100µs-stage behavior and CPU load on Windows. Evaluate the linked SleepEx and waitable-timer options; done means the wait no longer produces immediate wakeups and avoids the reported excess CPU load.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
operating-systems, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.