-
Notifications
You must be signed in to change notification settings - Fork 333
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
Propagate exceptions across threads #417
Comments
Obviously this is related to the fact that the lambda used with My first though was that we should mark the lambda function (and maybe functions used by it) as My conclusion is that we should still catch/rethrow exceptions from the threads to be safe. Happy to have some feedback from others with more experience though! |
We usually run parallel solving across multiple threads, e.g. for CVRP here. The problem is that if a worker thread were to throw for an unexpected reason, the current code would not propagate the exception to the main thread. I simulated this by throwing a
std::runtime_error
fromLocalSearch::run
, which result in an ugly:whereas we'd like to gracefully exit with what feedback we can
{"code": 1, "Internal error: ..."}
.The good news is I've had no report of this kind of failure so far but we should nevertheless use
std::exception_ptr
to handle this correctly, see e.g. https://vorbrodt.blog/2019/03/24/propagate-exceptions-across-threads/.The text was updated successfully, but these errors were encountered: