Skip to content

posix: timer: should use asynchronous cancellation. #67870

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

Closed
cfriedt opened this issue Jan 20, 2024 · 0 comments · Fixed by #67871
Closed

posix: timer: should use asynchronous cancellation. #67870

cfriedt opened this issue Jan 20, 2024 · 0 comments · Fixed by #67871
Assignees
Labels
area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@cfriedt
Copy link
Member

cfriedt commented Jan 20, 2024

Describe the bug

The test_timer_overrun test in tests/posix/common/src/timer.c was failing quite regularly for nrf52_bsim in CI. Ironically, it only did this after parts of pthread.c were fixed. Namely, respecting deferred vs asynchronous pthread cancelation.

Effectively, by not specifying to cancel the pthread asynchronously, it was allowed to continue running (detached, of course), and then after the sem was cleared in the next test, it tried to jump to NULL causing a segfault. Also, it might not be intuitive, but with POSIX threads, asynchronous cancellation means asynchronous w.r.t. cancellation points, and to synchronously w.r.t. the calling thread.

There is some additional setup required for nrf52_bsim to test locally so most tests are skipped unless you go out of your way to set up dependencies.

Please also mention any information which could help others to understand
the problem you're facing:

  • What target platform are you using? nrf52_bsim
  • What have you tried to diagnose or workaround this issue? CI here
  • Is this a regression? No, but it could have been 😁

To Reproduce
Steps to reproduce the behavior:

  1. Visit link
  2. See error

Expected behavior
The timer overrun test should succeed without segfaulting.

Impact
It's blocking a relatively high bugfix #67223

Logs and console output

d_00: @00:00:34.443970  ===================================================================
d_00: @00:00:34.443970  START - test_timer_overrun

INFO    - /__w/zephyr/zephyr/twister-out/nrf52_bsim/tests/posix/common/portability.posix.common.dynamic_stack/handler.log
INFO    - 685/685 nrf52_bsim                tests/posix/common/portability.posix.common  

https://github.com/zephyrproject-rtos/zephyr/actions/runs/7587603835/job/20668392712?pr=67223

Environment (please complete the following information):

Additional context

@cfriedt cfriedt added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug area: POSIX POSIX API Library labels Jan 20, 2024
@cfriedt cfriedt self-assigned this Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant