-
Notifications
You must be signed in to change notification settings - Fork 520
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
unsafeToFutureCancelable's cancel future completes before setting the result future's cancellation status #4047
Comments
We could "fix" this, but then we'd have the opposite problem: the original |
I assumed that's how it was intended to work, but perhaps it's less intuitive than I thought. While pondering, I decided to try the following program that avoids for {
a <- IO.never.start
winner <- a.join race a.cancel
} yield winner Seems that sometimes the result is |
Uhh, that definitely shouldn't hang. It's fine that the result is sometimes |
@mperucca Could you provide the complete code that you see hanging? I tried, but couldn't get it to hang with the snippet above... |
Well I've been trying that snippet again in a loop (along with I still think the original issue is surprising behavior, but maybe that's just me. |
Thanks for trying it again. I was thinking about the original issue too, and I tend to agree, that the behavior you expected is the "more intuitive" one. Although, I'd like to see what others think... |
Me too. However, this is due to a race condition and is not easy to solve.
Can't say if it's worth it, but actually I think this is an interesting idea i.e. |
The following fails fairly quickly:
I believe
future
actually has finished it's work, as the following doesn't fail:This was mostly confusing in unit tests that were nondeterministic as they tested that the cancellation worked. I think it'd be more intuitive if the future's cancellation status was set before cancel completes, but maybe there's something else unintuitive that would result from that that I'm not considering.
The text was updated successfully, but these errors were encountered: