From a71f53d7ac1b33ddd0142cc0627446d6b7db6198 Mon Sep 17 00:00:00 2001 From: Huihuang Zheng Date: Tue, 3 Dec 2019 10:11:27 +0800 Subject: [PATCH] Add warning message when initialize GLOG failed. (#21487) Add warning message when initialize GLOG failed --- paddle/fluid/platform/init.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/paddle/fluid/platform/init.cc b/paddle/fluid/platform/init.cc index 04687b0b38..ec7998161b 100644 --- a/paddle/fluid/platform/init.cc +++ b/paddle/fluid/platform/init.cc @@ -47,6 +47,7 @@ namespace framework { std::once_flag gflags_init_flag; std::once_flag p2p_init_flag; +std::once_flag glog_warning_once_flag; void InitGflags(std::vector argv) { std::call_once(gflags_init_flag, [&]() { @@ -202,6 +203,15 @@ void InitDevices(bool init_p2p, const std::vector devices) { void SignalHandle(const char *data, int size) { auto file_path = string::Sprintf("/tmp/paddle.%d.dump_info", ::getpid()); try { + // The signal is coming line by line but we print general guide just once + std::call_once(glog_warning_once_flag, [&]() { + LOG(WARNING) << "Initialize GLOG failed, PaddlePaddle may not be able to " + "print GLOG\n"; + LOG(WARNING) << "You could check whether you killed GLOG initialize " + "process or PaddlePaddle process accidentally\n"; + LOG(WARNING) << "The detail failure signal is:\n\n"; + }); + LOG(WARNING) << std::string(data, size); std::ofstream dump_info; dump_info.open(file_path, std::ios::app); -- GitLab