Skip to content

The test executable fails to run due to call stack exhausted (swift-wasm-DEVELOPMENT-SNAPSHOT-2024-03-22-a) #5573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kkebo opened this issue Mar 25, 2024 · 5 comments

Comments

@kkebo
Copy link

kkebo commented Mar 25, 2024

Description

Some test executables fail with the "call stack exhausted" error.

What they have in common:

  • they all have many test cases
  • the error occurs only when building with the latest (swift-wasm-DEVELOPMENT-SNAPSHOT-2024-03-22-a) toolchain
    • swift-wasm-DEVELOPMENT-SNAPSHOT-2024-03-20-a doesn't have this issue

Reproduction

Expected behavior

I expected the test executable to succeed in running.

In fact, the executable built with the previous (swift-wasm-DEVELOPMENT-SNAPSHOT-2024-03-20-a) toolchain has succeeded.

Environment

@kateinoigakukun
Copy link
Member

Thank you for detailed reproduction! Between the two snapshots, we introduced significant changes to XCTest to make the change acceptable for the upstream and the change includes how partial async jobs chains during the tests.

For such large scale test suites, we will recommend using tail-call enabled SDK after #5568 will be resolved.

For now, please extend stack size of wasmtime engine and C stack size in wasm binary:

# Extend stack size to 1mb
$ swift build -c release --build-tests --experimental-swift-sdk DEVELOPMENT-SNAPSHOT-2024-03-22-a-wasm -Xlinker -z -Xlinker stack-size=1048576
# 512kb (default) -> 1mb
$ wasmtime --wasm max-wasm-stack=1048576 --dir=/ .build/release/WasmTestExamplePackageTests.wasm

@kkebo
Copy link
Author

kkebo commented Mar 26, 2024

For now, please extend stack size of wasmtime engine and C stack size in wasm binary:

Thank you for providing a workaround. Unfortunately, I had already tried such an approach before I created the issue, but the result was the same. I gave up when I increased the size in stages up to 100 MB.

@kkebo
Copy link
Author

kkebo commented Mar 26, 2024

Oops, I overlooked --wasm max-wasm-stack=1048576.

@kateinoigakukun
Copy link
Member

@KKK669 Note that you need to increase the size of both wasmtime stack size and C stack size just in case.

kkebo added a commit to kkebo/swift-syntax that referenced this issue Mar 26, 2024
@kkebo
Copy link
Author

kkebo commented Mar 26, 2024

Thank you so much! The 16 MiB of stack is quite large, but the test is finally working again. I'll go with it until tail-call is ready.

https://github.com/kkk669/swift-syntax/actions/runs/8437995545/job/23109088958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants