Skip to content
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

Implement icall used by RuntimeHelpers.EnsureSufficientExecutionStack on netcore Mono. #33857

Merged
merged 1 commit into from
Mar 24, 2020

Conversation

lateralusX
Copy link
Member

Current implementation always returned true for Windows/Linux/Android. There are however use of this API in Task library to make sure recursive tasks won't hit stackoverflow. There are several tests in System.Threading.Tasks that currently hit this, at least on Windows, causing test failures.

Fix use stack limits already setup in register_thread and used by GC when doing conservative stack scan. If the limits have not been setup or is not supported on platform, we will use old defaults, always assume there is enough stack space available. Heuristics around size of minimum execution
stack needed are picked from corresponding CoreCLR implementation.

With this fix all tests run in System.Threading.Tasks.Tests pass on Windows using Mono runtime:

=== TEST EXECUTION SUMMARY ===
     System.Threading.Tasks.Tests  Total: 682, Errors: 0, Failed: 0, Skipped: 3, Time: 11,419s
----- end 2020-03-20 13:43:35,72 ----- exit code 0 ----------------------------------------------------------

Before fix the following tests hit stackoverflow:

LongContinuationChain_ContinueWith_DoesNotStackOverflow
LongContinuationChain_Unwrap_DoesNotStackOverflow
LongContinuationChain_Await_DoesNotStackOverflow
RunStackGuardTests

… on netcore Mono.

Current implementation always returned true for Windows/Linux/Android.
There are however use of this API in Task library to make sure recursive
tasks won't hit stackoverflow. There are several tests in System.Threading.Tasks
that currently hit this, at least on Windows, causing test failures.

Fix use stack limits already setup in register_thread and used by GC when
doing conservative stack scan. If the limits have not been setup or is not
supported on platform, we will use old defaults, always assume there is
enough stack space available. Heuristics around size of minimum execution
stack needed are picked from corresponding CoreCLR implementation.
@lateralusX lateralusX force-pushed the lateralusX/fix-ensure-stack branch from 849b009 to edbb000 Compare March 23, 2020 08:06
@lateralusX lateralusX merged commit b020c37 into dotnet:master Mar 24, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants