[BUG] vTaskSuspend/vTaskResume causes xTaskDelayUntil to always fail

Đang mở
#1,349 23 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 ngày

@kstribrnAmzn đang làm issue này rồi.

Từ ngày 29/12/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

enhancement

I think that my loop starts with a last wake up time (last) greater than the current time (tick, from xTaskGetTickCount) and #1339 does the rest, so xTaskDelayUntil becomes a no-op and fails always.

  • Development board: ESP32-S3, dual core
  • Instruction Set Architecture: XTENSA32 LX7?
  • IDE and version: esp-idf 5.5.1
  • Toolchain and version: xtensa-esp-elf esp-14.2.0_20241119
  • Host OS: Archlinux

To Reproduce

#include "freertos/FreeRTOS.h"
#include <stdio.h>

static void loop(void *data)
{
        TickType_t last = xTaskGetTickCount();
        for (int i = 0; ; ++i) {
                if (xTaskDelayUntil(&last, 5) == pdFALSE) {
                        printf("Iteration %d too slow (last=%lu, tick=%lu)\n", i, last, xTaskGetTickCount());
                }
        }
}

void app_main(void)
{
        TaskHandle_t handle;
        xTaskCreate(loop, "TEST", 2048, NULL, 1, &handle);
        /* The following two lines trigger the issue */
        vTaskSuspend(handle);
        vTaskResume(handle);
}

With the above code, I get a busy loop that starts with:

Iteration 1 too slow (last=11, tick=2)
Iteration 2 too slow (last=16, tick=3)
Iteration 3 too slow (last=21, tick=3)
Iteration 4 too slow (last=26, tick=4)

Without vTaskSuspend/vTaskResume everything works as expected.

No idea how last can be greater than tick or if this is an issue specific to the dual core nature of the ESP32-S3 (i.e. the above code works on other architectures).

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FreeRTOS/FreeRTOS-Kernel

Tất cả issue của FreeRTOS/FreeRTOS-Kernel

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.