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
Ambiguity of nested hpx::future<void>'s. #2667
Comments
This is intended behavior. How could the outer future not become ready if the inner future is available? |
Just to clarify: for the code snippet you showed, the outermost future should not become ready before
the returned outer future will become ready as soon as the inner async has returned. In other words, the automatic unwrapping of |
There must be a bug then, because I don't think that's what is happening. I will try and reproduce it with a smaller code sample. |
You might be able to create a succinct test case that uses exceptions. If the outer future is ready too early, then any exceptions thrown by the inner future have no place to go any more. |
Hi Erik
Can you give me an example where the outer future is ready too early. I
think that always outer future will be ready after the inner one
completes(because may depend on inner future) and in case of exception in
outer future I think inner future will not execute . If I'm wrong please
correct me!
|
@Praveenv98 The original code Dominic showed above exposes this behavior. |
I am having trouble reproducing this behavior with a simple code, and the Octotiger bug I thought I had fixed by explicitly getting the inner futures before return appears to be popping back up again. (Though it takes longer before it happens). At this point I'm no longer 100% convinced the HPX bug I think is there actually exists, it may still be a bug in my own code. |
@dmarce1 You were right after all. The current code allows to implicitly convert a Doing the same for a I will create a patch which inhibits the former conversion at compile time. |
When future < T > is created using a function returning a future < T > instead of a T, the outer future is not made ready until the inner future is complete.
However, when a futue< void > is created using a function returning a future< void > instead of void, the outer future is made ready as soon as the inner future is returned - which could be (and often is) before the inner future is made ready.
Example:
Given the behavior of nested non-void futures, one would expect fut would not be made ready until after do_more_work() is executed. Apparently (from bugs I have fixed in Octo-tiger) this is not the case. Instead fut is made ready when the inner future is created and returned, which is (usually) before do_more_work() is complete.
I have fixed two bugs in Octo-tiger that were of this type, and each time the bugs were not readily reproducible and took many days and SUs to narrow down the problem and confirm I had fixed it.
Is this the intended behavior of nested void futures or is this a bug?
The text was updated successfully, but these errors were encountered: