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

Exceptions thrown in asynchronous calls can be lost if the value of the future is never queried #1026

Closed
brycelelbach opened this issue Nov 27, 2013 · 4 comments
Assignees
Milestone

Comments

@brycelelbach
Copy link
Member

Typically, if an exception is thrown inside of an action/function invoked by hpx::async, the exception is stored in the shared state of the future and reported when the user calls .get() on the future (it is either rethrown or stored in the user-supplied hpx::error_code).

However, if the user does not call .get() on the future, the exception will not be reported (see testcase). I believe this is very dangerous behavior, because I don't believe most users would expect this - it's a "gotcha".

I had an issue with this today, and I only found out about the exception by going through the logs.

I think that we must abort if a future is being destroyed and it has an exception that has never been retrieved. Simply logging (even at the error log level) is not sufficient. Obviously we can't throw from the future dtor.

brycelelbach added a commit that referenced this issue Nov 27, 2013
@brycelelbach
Copy link
Member Author

Do we currently have a way of determining (from within the future) whether the value of the future has been queried?

@hkaiser
Copy link
Member

hkaiser commented Nov 27, 2013

We don't have that. Do we need it?

@ghost ghost assigned hkaiser Nov 27, 2013
@hkaiser
Copy link
Member

hkaiser commented Nov 27, 2013

The added test is wrong. The only way to handle an exception received from a future is to call .get(). Please remove the test as it's misleading.

@ghost ghost assigned brycelelbach Nov 27, 2013
@hkaiser
Copy link
Member

hkaiser commented Nov 27, 2013

The test has been removed by 6cee12a

@hkaiser hkaiser closed this as completed Nov 27, 2013
sithhell pushed a commit that referenced this issue Dec 6, 2013
sithhell pushed a commit that referenced this issue Dec 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants