未验证 提交 a71f53d7 编写于 作者: H Huihuang Zheng 提交者: GitHub

Add warning message when initialize GLOG failed. (#21487)

Add warning message when initialize GLOG failed
上级 b3090ad4
...@@ -47,6 +47,7 @@ namespace framework { ...@@ -47,6 +47,7 @@ namespace framework {
std::once_flag gflags_init_flag; std::once_flag gflags_init_flag;
std::once_flag p2p_init_flag; std::once_flag p2p_init_flag;
std::once_flag glog_warning_once_flag;
void InitGflags(std::vector<std::string> argv) { void InitGflags(std::vector<std::string> argv) {
std::call_once(gflags_init_flag, [&]() { std::call_once(gflags_init_flag, [&]() {
...@@ -202,6 +203,15 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) { ...@@ -202,6 +203,15 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
void SignalHandle(const char *data, int size) { void SignalHandle(const char *data, int size) {
auto file_path = string::Sprintf("/tmp/paddle.%d.dump_info", ::getpid()); auto file_path = string::Sprintf("/tmp/paddle.%d.dump_info", ::getpid());
try { 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); LOG(WARNING) << std::string(data, size);
std::ofstream dump_info; std::ofstream dump_info;
dump_info.open(file_path, std::ios::app); dump_info.open(file_path, std::ios::app);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册