Skip to content

Stack overflow in graph update when snapshotting OSUI's LabeledContent #47

Description

@Kyle-Ye

Summary

When OpenSwiftUI runs its snapshot UI tests with the Compute backend, LabeledContentUITests can crash with a stack overflow / stack guard EXC_BAD_ACCESS.

This reproduces even when running the LabeledContentUITests suite by itself. The attached crash report is from LabeledContentUITests.customStyle().

Compute version

I am using Compute as a source dependency:

  • Compute tag: 0.3.0-bugfix.1
  • Compute revision: bf9cfe57ba8b3dc7307a95fb10a6133e70db3089
  • Config:
    • OPENSWIFTUI_OPENATTRIBUTESHIMS_ATTRIBUTEGRAPH=0
    • OPENSWIFTUI_OPENATTRIBUTESHIMS_COMPUTE=1
    • OPENSWIFTUI_OPENATTRIBUTESHIMS_COMPUTE_BINARY=0
    • OPENSWIFTUI_OPENATTRIBUTESHIMS_COMPUTE_SOURCE_VERSION=0.3.0-bugfix.1

Environment

  • Host OS: macOS 26.5.1 (25F80)
  • Xcode: 26.3 (17C529)
  • Crash report: TestingHost-2026-07-05-225029.ips included below
  • The crash report is from iOS Simulator.

Reproduction

From an OpenSwiftUI checkout that supports the Compute Example setup:

cd Example
./setup.sh --compute

Then run the OpenSwiftUI UI test suite with the Compute backend, with the temporary LabeledContentUITests Compute disable removed:

xcodebuild test \
  -workspace Example.xcworkspace \
  -scheme OSUI_UITests \
  -destination 'platform=iOS Simulator,name=<available simulator>' \
  -only-testing:OpenSwiftUIUITests/LabeledContentUITests \
  -parallel-testing-enabled NO \
  -skipMacroValidation \
  -skipPackagePluginValidation

The crash also reproduces when running the LabeledContentUITests suite individually, so it does not appear to require the full test plan.

Expected behavior

The graph update should finish normally, or at least fail with a bounded diagnostic instead of recursively overflowing the stack.

Actual behavior

The process crashes with:

EXC_BAD_ACCESS / SIGSEGV
KERN_PROTECTION_FAILURE at stack guard
Could not determine thread index for stack guard region

The crash report shows deep recursion around Compute graph update:

IAG::Graph::propagate_dirty(IAG::AttributeID)
IAG::Graph::value_set(...)
IAGGraphSetValue
Attribute.setValue(_:)
Attribute.wrappedValue.setter
...
IAG::Graph::UpdateStack::update()
IAG::Graph::update_attribute(...)
IAG::Graph::input_value_ref_slow(...)
IAG::Graph::input_value_ref(...)

The recursion summary in the crash report includes:

key frame: IAG::Graph::update_attribute(...)
depth: 3414

The bottom of the relevant stack reaches:

LabeledContentUITests.customStyle()
openSwiftUIAssertSnapshot(...)
SnapshotTesting.verifySnapshot(...)

Notes

This is using OpenSwiftUIProject/Compute rather than jcmosc/Compute. The fork is currently very close to upstream and does not contain substantial behavior changes relevant to this crash.

Full crash report:

TestingHost-2026-07-05-225029.ips.zip

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