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

add test and fix #3254 #3255

Merged
merged 6 commits into from
Jun 27, 2017
Merged

add test and fix #3254 #3255

merged 6 commits into from
Jun 27, 2017

Conversation

matthid
Copy link
Contributor

@matthid matthid commented Jun 24, 2017

@msftclas
Copy link

@matthid,
Thanks for your contribution.
To ensure that the project team has proper rights to use your work, please complete the Contribution License Agreement at https://cla.microsoft.com.

It will cover your contributions to all Microsoft-managed open source projects.
Thanks,
Microsoft Pull Request Bot

@msftclas
Copy link

@matthid, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request.

Thanks, Microsoft Pull Request Bot

@eiriktsarpalis
Copy link
Member

@matthid good catch, this should never have been added. Could also remove the continueWithExtra definition?



[<Test>]
member this.RunSynchronouslyCancellationWithDelayedResult () =
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some kind of timeout to this test? Assuming the fix is not in place that test would run forever. Perhaps configurable via nunit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually thought about that, but to be honest there are a lot of tests with similar expectations. Not sure a timeout there is worth it, but I can of course add one if you don't agree

Copy link
Member

Choose a reason for hiding this comment

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

as long as it doesn't obscure the intention of the test I guess

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done

@matthid
Copy link
Contributor Author

matthid commented Jun 24, 2017

@matthid good catch, this should never have been added. Could also remove the continueWithExtra definition?

Yep added.

@eiriktsarpalis
Copy link
Member

@matthid this issue seems related #2770 (comment) could you also include this here? @saul

@matthid
Copy link
Contributor Author

matthid commented Jun 24, 2017

@eiriktsarpalis Any idea how a test for this would look like or what wrong behavior this would expose?
I can include it here but then there will be no test :)
To be honest I don't even think this code-path is used in any real life code. Only Async.Sleep is using it and there the result is correct, isn't it?

@eiriktsarpalis
Copy link
Member

To be honest I don't even think this code-path is used in any real life code. Only Async.Sleep is using it and there the result is correct, isn't it?

That's correct. It's splitting hairs really, but I happened to spot this in the same PR you're reverting.

@matthid
Copy link
Contributor Author

matthid commented Jun 24, 2017

@eiriktsarpalis ok perfect, added it :)

@eiriktsarpalis
Copy link
Member

Cheers, lgtm

@matthid
Copy link
Contributor Author

matthid commented Jun 24, 2017

@eiriktsarpalis It seems like something doesn't like the timeout attribute, ideas?

@dsyme
Copy link
Contributor

dsyme commented Jun 26, 2017

What the cancellationToken does at this place is cancel the Task which is RETURNED by ContinueWith which means the continuation is never called. I'd remove this parameter.

Ugh... good catch, and I'm glad we found this now rather than later.

Copy link
Contributor

@dsyme dsyme left a comment

Choose a reason for hiding this comment

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

I need to look at this again after reading further comments


let continueWithUnit (task : Task, args, useCcontForTaskCancellation) =

let continuation (completedTask : Task) : unit =
args.aux.trampolineHolder.Protect((fun () ->
if completedTask.IsCanceled then
if useCcontForTaskCancellation
then args.aux.ccont (new OperationCanceledException(args.aux.token))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an intrinsic part of this fix? Or is only https://github.com/Microsoft/visualfsharp/pull/3255/files#diff-34ee82347e9e0b47265fcecaa4850174R1567 needed? If the latter, please remove this change to keep the changes entirely separate,

else args.aux.econt (ExceptionDispatchInfo.Capture(new TaskCanceledException(completedTask)))
elif completedTask.IsFaulted then
args.aux.econt (MayLoseStackTrace(completedTask.Exception))
else
args.cont completedTask.Result)) |> unfake

task.ContinueWith(Action<Task<'T>>(continuation), continueWithExtra args.aux.token) |> ignore |> fake
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an intrinsic part of this fix? Or is only https://github.com/Microsoft/visualfsharp/pull/3255/files#diff-34ee82347e9e0b47265fcecaa4850174R1567 needed? If the latter, please remove this change to keep the changes entirely separate,

let continueWith (task : Task<'T>, args, useCcontForTaskCancellation) =

let continuation (completedTask : Task<_>) : unit =
args.aux.trampolineHolder.Protect((fun () ->
if completedTask.IsCanceled then
if useCcontForTaskCancellation
then args.aux.ccont (new OperationCanceledException(args.aux.token))
then args.aux.ccont (new OperationCanceledException())
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an intrinsic part of this fix? Or is only https://github.com/Microsoft/visualfsharp/pull/3255/files#diff-34ee82347e9e0b47265fcecaa4850174R1567 needed? If the latter, please remove this change to keep the changes entirely separate,

@dsyme
Copy link
Contributor

dsyme commented Jun 26, 2017

My understanding is that only the one line change https://github.com/Microsoft/visualfsharp/pull/3255/files#diff-34ee82347e9e0b47265fcecaa4850174L1575 is required for the fix, the rest is a different issue?

@matthid
Copy link
Contributor Author

matthid commented Jun 26, 2017

The change was requested because it's part of the commit which broke this. I honestly don't care if it is part of this or not as I noted above it's basically changing nothing...

So I don't understand why I had to add it (it's basically cleanup) nor why now I should remove it again :/

So I'm fine either way but don't make me change that back and forth. @dsyme Did you see the above discussion and still think I should remove it?

/cc @eiriktsarpalis

@dsyme
Copy link
Contributor

dsyme commented Jun 26, 2017

So I don't understand why I had to add it (it's basically cleanup) nor why now I should remove it again :/

Remove it please to minimise the required change, thanks

@dsyme
Copy link
Contributor

dsyme commented Jun 27, 2017

@matthid I updated the PR directly, thanks

@dsyme
Copy link
Contributor

dsyme commented Jun 27, 2017

@KevinRansom this is ready

@matthid
Copy link
Contributor Author

matthid commented Jun 27, 2017

@dsyme thanks. i'd probably rebase it and remove all those commits. but if you are fine with them I can leave it as is

@matthid
Copy link
Contributor Author

matthid commented Jun 27, 2017

Problem is I'm quite busy the mext days so it could take a while

@dsyme
Copy link
Contributor

dsyme commented Jun 27, 2017

@matthid No problem - we will squash & merge in any case :)

@dsyme dsyme merged commit c6a070b into dotnet:master Jun 27, 2017
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.

None yet

5 participants