From a3960a0eeffac9467a5b3d4b525007d83ae137de Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 22 Aug 2018 13:24:25 -0700 Subject: [SE] Avoid deadlock by calling HostCallbacks even when the stream is in an error state HostCallbacks may trigger notifications that, if elided, would cause programs to hang. Ideally we would have errback semantics, but this is a band-aid while the semantics are redefined. PiperOrigin-RevId: 209818770 --- tensorflow/stream_executor/stream.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'tensorflow/stream_executor') diff --git a/tensorflow/stream_executor/stream.cc b/tensorflow/stream_executor/stream.cc index 3695c839b5..19d3b2389a 100644 --- a/tensorflow/stream_executor/stream.cc +++ b/tensorflow/stream_executor/stream.cc @@ -5287,12 +5287,11 @@ Stream &Stream::ThenTransformTensor(const dnn::BatchDescriptor &input_desc, Stream &Stream::ThenDoHostCallback(std::function callback) { VLOG_CALL(PARAM(callback)); - if (ok()) { - CheckError(parent_->HostCallback(this, callback)); - } else { + if (!ok()) { LOG(INFO) << DebugStreamPointers() << " was in error state before adding host callback"; } + CheckError(parent_->HostCallback(this, std::move(callback))); return *this; } @@ -5300,12 +5299,11 @@ Stream &Stream::ThenDoHostCallbackWithStatus( std::function callback) { VLOG_CALL(PARAM(callback)); - if (ok()) { - CheckError(parent_->HostCallback(this, std::move(callback))); - } else { - LOG(WARNING) << "stream " << DebugStreamPointers() - << " was in error state before adding host callback"; + if (!ok()) { + LOG(INFO) << DebugStreamPointers() + << " was in error state before adding host callback"; } + CheckError(parent_->HostCallback(this, std::move(callback))); return *this; } -- cgit v1.2.3