From e7675dd542cedd20a6da7ac766db2657674eb6d7 Mon Sep 17 00:00:00 2001 From: Wang Guibao Date: Thu, 20 Dec 2018 12:40:54 +0800 Subject: [PATCH] Avoid calling VLOG() when program exiting (#14937) * Avoid calling VLOG() when program exiting test=develop * Avoid calling VLOG() when program exiting test=develop --- paddle/fluid/operators/distributed/grpc_client.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/operators/distributed/grpc_client.cc b/paddle/fluid/operators/distributed/grpc_client.cc index 78956c9ea49..8c54159a41e 100644 --- a/paddle/fluid/operators/distributed/grpc_client.cc +++ b/paddle/fluid/operators/distributed/grpc_client.cc @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +#include #include #include "glog/logging.h" // For VLOG @@ -420,7 +421,15 @@ void GRPCClient::Proceed() { sync_cond_.notify_all(); } } - VLOG(3) << "GRPCClient Proceed end"; + + // Last log message + // Avoid using VLOG() and LOG(): in the destructor of google::LogMessage() a + // static Mutex log_mutex is used for synchronization, which might have been + // destructed at this moment. + if (FLAGS_v >= 3) { + std::string msg("GRPCClient Proceed end"); + fwrite(msg.c_str(), msg.length(), 1, stdout); + } } std::shared_ptr GRPCClient::GetChannel(const std::string& ep) { -- GitLab