From 0edc81136c138368f500aba5aa0e0667e30befe4 Mon Sep 17 00:00:00 2001 From: Ilia Cherniavskii Date: Wed, 20 Feb 2019 16:22:01 -0800 Subject: Rethrow exceptions from RunAsync (#15034) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15034 Rethrow exception happened during RunAsync, ensure that pending tasks are not executed after marked as finished Reviewed By: andrewwdye Differential Revision: D13409649 fbshipit-source-id: 3fd12b3dcf32af4752f8b6e55eb7a92812a5c057 --- caffe2/core/net_async_scheduling.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/caffe2/core/net_async_scheduling.cc b/caffe2/core/net_async_scheduling.cc index 3e0f36613e..8b6f13354b 100644 --- a/caffe2/core/net_async_scheduling.cc +++ b/caffe2/core/net_async_scheduling.cc @@ -254,7 +254,11 @@ bool AsyncSchedulingNet::RunAsync() { } catch (const std::exception& e) { LOG(ERROR) << "Exception while starting an async run: " << e.what(); finishRun(); - return false; + throw; + } catch (...) { + LOG(ERROR) << "Exception while starting an async run: unknown error"; + finishRun(); + throw; } // schedule() is not expected to throw, at this moment all the initial tasks -- cgit v1.2.3