-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sys/ztimer: implement ztimer_mbox_get_timeout() and use it to fix race in gnrc_sock_recv() #21113
sys/ztimer: implement ztimer_mbox_get_timeout() and use it to fix race in gnrc_sock_recv() #21113
Conversation
This function fetches a message from an mbox, possibly blocking if the mbox has no message - but with a specified timeout.
aff3a6a
to
97e862c
Compare
97e862c
to
a1fd9e3
Compare
Fixed a typo found by codespell and squashed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a much cleaner solution than what has been there before.
Uh the provided test fails on CI
|
Implement the timeout using ztimer_mbox_get_timeout() to fix a race condition.
a1fd9e3
to
56ea5cd
Compare
Let's try again with even more relaxed timeout on |
Thx! |
This reverts commit e3d0068, which added a work around for two bugs: - ztimer triggering too early (fixed in RIOT-OS#20924) - gnrc_sock_recv() returning when an old "timeout" message is still in the message queue (fixed in RIOT-OS#21113) With those bugs fixed, the work around should not longer be needed.
The test is flaky on |
Contribution description
This implements
ztimer_mbox_get_timeout()
and salvages the test app from #18977 with minor tweaking.On top of
ztimer_mbox_get_timeout()
, the timeout ofgnrc_sock_recv()
is now implemented race-free.Testing procedure
Run the provided test app. (Maybe also set
ENABLE_DEBUG
to1
insys/ztimer/utils.c
to ensure that the race when a message was received just in time but the timeout was not cancelled in time is indeed triggered by the test app.)Also do some testing with GNRC's SOCK implementation and proper timeout handling.
Issues/PRs references
Better alternative to #18977