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

Fix Async.Parallel stack overflow on cancellation of ~2000 uncompleted #13186

Merged
merged 3 commits into from
May 24, 2022

Conversation

dsyme
Copy link
Contributor

@dsyme dsyme commented May 23, 2022

Fixes #13165

@dsyme
Copy link
Contributor Author

dsyme commented May 23, 2022

Transient failure: Move-Item : Access to the path 'C:\Users\cloudtest\.netcoreeng\native\bin\perl\5.32.1.1.tmp' is denied.

let gen (i : int) = async {
if i <> 0 then do! Async.Sleep i
else return failwith (string i) }
let count = 1800

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is to function as a regression test in perpetuity and/or across platforms/processors, perhaps doubling this empirically derived value might make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubled!

@vzarytovskii
Copy link
Member

One leg is failing with:

Move-Item : Access to the path 'C:\Users\cloudtest.netcoreeng\native\bin\perl\5.32.1.1.tmp' is denied.

AFAIU dnceng are working on it, @brettfo is that correct?

@@ -764,3 +764,15 @@ type AsyncModule() =
lock gate <| fun () -> printfn "Unhandled exception: %s" exn.Message
lock gate <| fun () -> printfn "Semaphore count available: %i" semaphore.CurrentCount
Assert.AreEqual(acquiredCount, releaseCount)

[<Fact>]
member _.``Async.Parallel blows stack when cancelling many`` () =
Copy link

@bartelink bartelink May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
member _.``Async.Parallel blows stack when cancelling many`` () =
// versions 4.7 - 6.0.4 impl didn't tail recurse as intended and hence can blow the stack given ~1600 excess computations at point of cancellation
member _.``Async.Parallel handles early cancelation of large computation streams safely`` () =

@dsyme dsyme merged commit 1d1eb4c into dotnet:main May 24, 2022
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

Successfully merging this pull request may close these issues.

Async.Parallel stack overflow on cancellation of ~2000 uncompleted computations
3 participants