[BUG] vTaskSuspend/vTaskResume causes xTaskDelayUntil to always fail

オープン
#1,349 コメント 23 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

@kstribrnAmzn がすでに取り組んでいます。

2025年12月29日 から。

評価

この issue はまだ評価されていません。

説明

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).

主要言語
C
スター
4.6k
フォーク
1.6k
平均マージ
2日 22時間
マージ済み PR(30日)
4

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FreeRTOS/FreeRTOS-Kernel のほかの issue

FreeRTOS/FreeRTOS-Kernel の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。