Skip to content

[URGENT] Queue allocation is broken after update to 11.0.1 #136

@neboskreb

Description

@neboskreb

[URGENT] This issue breaks an essential functionality.

Description

Queue allocation is broken after update to 11.0.1. Queues bigger than just few elements cannot be created.

The issue was introduced upstream by this commit to FreeRTOS-Kernel

Reproducing

Environment:

  • Arduino_FreeRTOS Version: 11.0.1, 11.1.0 (current)
  • Target platform: ATMega2560
  • Host platform: Intel x64

Expected behavior

A queue for 64 items of 4 bytes each should be created:

QueueHandle_t result = xQueueGenericCreate(64, 4, queueQUEUE_TYPE_BASE);


Actual behavior

The operation fails internally, and the call returns NULL.

A smaller queue, e.g. 10 elements of 2 bytes, is created successfully.

Minimal reproducible example

Given proper type definitions, the issue is reproduced on a host platform Intel x64 as well. Test file for GTest is attached.

Analysis

The upstream commit which introduced the issue has added a cast to UBaseType_t in the parameter validation block.

Screenshot

The fault is caused by the size of UBaseType_t on AVR which is uint8_t, meaning its maximum value is 255. This reduces the max "valid" size to a very small number.

Bigger CPUs like SAM/ARM which have UBaseType_t defined as uint16_t/uint32_t do not suffer this issue because such a large queues are not allocated in practice. Therefore, this issue is unlikely to be noticed in the upstream repo.

Possible solutions

A) Remove only the broken cast at line 516
B) Revert the entire commit which introduced the issue
C) Remove the parameter validation block

I would recommend solution C. Let's discuss pros and contras in the comments section.

Action points

I shall draft a PR once we agree on the solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions