Skip to content

deep_nesting test intermittently overflows its stack on Windows CI #832

Open

Description

@JuroOravec

(Opus 5.5)

The deep_nesting test of citry_template_parser sometimes overflows its stack on the Windows runner, and the "Rust tests" workflow fails with:

thread '<unknown>' has overflowed its stack
error: test failed, to rerun pass `-p citry_template_parser --test deep_nesting`

A rerun passes. It has happened three times so far, each time on a change that touched no Rust code:

The macOS job in the same run is then cancelled by fail-fast, so one flake blocks the whole workflow.

What the test does

crates/citry_template_parser/tests/deep_nesting.rs parses, compiles, clones, compares, prints and drops templates up to the nesting limits (MAX_TAG_NESTING, MAX_LOGIC_NESTING) on threads with 256 KiB and 128 KiB stacks. It enters through with_enough_stack, the way the Python bindings do. The module comment says a new Windows thread has about 26 KiB less free stack than a Linux one, and the 128 KiB Windows case is expected to run entirely on a heap stack segment.

What to find out first

The log doesn't say which test case overflowed, because the cases run in parallel. Before changing limits:

  1. Reproduce on Windows with cargo test -p citry_template_parser --test deep_nesting -- --test-threads=1, in a loop, to find the case and the stack size.
  2. Decide between:
    • a real gap: a path that grows the stack without passing a with_enough_stack guard, or a guard whose red zone (RED_ZONE) is too small for a Windows debug build. In that case, fix the guard; the same guards protect the Python bindings.
    • test-only margin: the test's own frames, such as with_stack_left or the thread entry, use the last few KiB. In that case, give the test more headroom on Windows, and say why in a comment.

The overflow is a hard abort, so the answer matters beyond CI: the inputs are templates (written by the template author), and the depth limits exist so that any accepted template parses on small thread stacks.

🤖 Generated with Claude Code

https://claude.ai/code/session_017pjjQdqk1kqBV42Y1fCNcx

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions