[BUG] Empty core affinity mask strands a ready task and permanently starves lower priority tasks (configRUN_MULTIPLE_PRIORITIES 0)
Maintainer thường phản hồi trong vòng 3 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 15/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- c
- Lĩnh vực
- operating-systems
Hướng nghiên cứu
The relevant code is prvSelectHighestPriorityTask() in tasks.c, which handles ready-list selection and uxTopReadyPriority, and the affinity setters vTaskCoreAffinitySet() and the xTaskCreate*AffinitySet functions, which store the mask without validating it. Read how the selection loop skips tasks whose affinity excludes the current core, then reproduce with configNUMBER_OF_CORES 2 and configRUN_MULTIPLE_PRIORITIES 0. Done means either the zero mask is rejected at the API or the top-priority pin no longer starves eligible lower-priority tasks. The reporter says a fix is already prepared, so check for linked work before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
vTaskCoreAffinitySet() and xTaskCreateAffinitySet()/xTaskCreateStaticAffinitySet() store the mask unconditionally. A zero mask is accepted (task.h documents no non-zero precondition; no configASSERT rejects it) and makes the task ready but runnable on no core.
With configRUN_MULTIPLE_PRIORITIES 0 (the FreeRTOS.h default) the selection drop rule in prvSelectHighestPriorityTask() then pins uxTopReadyPriority on that task's ready list (the list is non-empty, so the top priority is not decremented), and every selection falls back to the idle tasks (uxCurrentPriority = tskIDLE_PRIORITY when below the top). Lower-priority tasks that are ready and eligible on every core are permanently starved while the system idles.
Target
- Development board: any SMP target (reproduced on a POSIX host-port harness with
configNUMBER_OF_CORES 2,configRUN_MULTIPLE_PRIORITIES 0,configUSE_CORE_AFFINITY 1) - Instruction Set Architecture: host arm64 reproduction
- Toolchain and version: clang (host), FreeRTOS-Kernel
8be86d4a2
To Reproduce
Public APIs only. The mask is producible by a caller computing an allowed-core set dynamically (e.g. after offlining the last eligible core):
- Create tasks; set one task's mask to 0 via
vTaskCoreAffinitySet( handle, 0 )(or create withxTaskCreateAffinitySet(..., 0, ...)). - Observe: the task stays
eReadybut never runs; every other task below its priority freezes (progress counters flat in the harness window while idle iterations run into the millions); only idle tasks run.
Control: the identical run with a valid non-empty mask keeps making progress.
Expected behavior
- An empty mask should be rejected or ignored at the API (a
configASSERTplus a documented non-zero precondition is the usual pattern; note asserts compile out in release builds, so an always-on guard is preferable here). prvSelectHighestPriorityTask()must not pinuxTopReadyPriorityon a ready list containing only tasks that are runnable on no core - no core can ever select from such a list, and leaving it pinned starves eligible tasks at lower priorities.
Additional context
- Related but different: PR #1264 (closed, unmerged) publicly describes only the idle-absence -> stuck-
SCHEDULED_TO_YIELDspin (tracked in a separate follow-up issue). #1086/PR #1123 fixed a different affinity mechanism (missing re-select after affinity change). - A fix with regression tests is prepared; PRs will reference this issue.
- Ngôn ngữ chính
- C
- Star
- 4.6k
- Fork
- 1.6k
- Merge trung bình
- 2 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của FreeRTOS/FreeRTOS-Kernel
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FreeRTOS/FreeRTOS-Kernel#1542 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[BUG] Release asset FreeRTOS-KernelV11.3.2.zip has the files of main, not of the tag V11.3.2Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
FreeRTOS/FreeRTOS-Kernel#1520 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
FreeRTOS/FreeRTOS-Kernel#1494 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
FreeRTOS/FreeRTOS-Kernel#1554 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[BUG] event_wait_timed can't return falseCó thể đã có người làm @TedLyngmo đã nhận 39 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
FreeRTOS/FreeRTOS-Kernel#1546 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của FreeRTOS/FreeRTOS-Kernel
Issue tương tự
-
RecompLauncher supportĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
shinyquagsire23/OpenJKDF2#540 ·
Maintainer thường phản hồi trong vòng 12 ngày
-
Prison work hall: laundry and kitchen stations stand at bare walls, the hatch has no counter or signĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Life-Framework/Life-Framework#5939 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
autoconf failes to find libsodium even when present due to implicit function declarationCó thể đã có người làm @coderjoe đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 13 ngày
-
SessionInterfaceHandler is throwing a deprecation notice as a warning instead of a deprecationĐang mởBug Status: Needs Triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement_package: a site operand of another JSON type raises TypeError, not a named refusalĐang mởbug python
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
Jstar269/nakagawa-recomp#3521 ·
Maintainer thường phản hồi trong vòng 1 ngày