Skip to content

tests/ui/codegen/huge-stacks.rs fails in a constrained QEMU environment where the guest has 1 GB of RAM #158557

Description

@DeepeshWR

The failure is:

thread 'main' panicked at tests/ui/codegen/huge-stacks.rs:20:10:
called `Result::unwrap()` on an `Err` value:
Os { code: 11, kind: WouldBlock, message: "Resource temporarily unavailable" }

The failure occurs while creating the test thread:

std::thread::Builder::new()
    .stack_size(5 * 1024 * 1024 * 1024)
    .spawn(func)
    .unwrap();

spawn() returns Err(EAGAIN) because the kernel refuses to create a thread with the requested 5 GB stack under the available resources.

Environment
Rust: 1.98.0-nightly
Linux
QEMU guest
Guest RAM: 1024 MB

Reproduction
Run the UI test inside a QEMU guest configured with:
-m 1024
The test fails with EAGAIN.

When the guest memory is increased to:
-m 8192
the same test passes successfully without any other changes.

Expected
If this test requires a minimum amount of available memory or address space, it may be helpful to:
- document the requirement,
- skip gracefully when std::thread::Builder::spawn() fails with EAGAIN, or
- otherwise make the test failure indicate that the environment is insufficient rather than panicking via unwrap().

Notes
This does not appear to be a code generation regression. The failure occurs before the test body executes because thread creation fails.

cc: @wesleywiser

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions