aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-11-30 14:14:29 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-11-30 14:21:22 -0800
commit6ebb6d6465ddf2380430de7aa287676e9440df7e (patch)
treeaa9a86a331d30b56fffa4ecd4fdfd2fe25c9b913
parent3a011f904112fe8c61017248d343798569b174f0 (diff)
TF server should not crash when -v=1 is enabled.
These WriteTextProto() calls are purely for diagnostics (and are usually called within IF_VLOG_IS_ON(1) guards), but if they fail to write to a file, they'll take down the entire calling process. Which makes debugging difficult, and seems rather astonishing. PiperOrigin-RevId: 177506379
-rw-r--r--tensorflow/compiler/tf2xla/dump_graph.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/tensorflow/compiler/tf2xla/dump_graph.cc b/tensorflow/compiler/tf2xla/dump_graph.cc
index ddd912b873..03603ee9ba 100644
--- a/tensorflow/compiler/tf2xla/dump_graph.cc
+++ b/tensorflow/compiler/tf2xla/dump_graph.cc
@@ -63,7 +63,12 @@ string MakeUniquePath(string name) {
string DumpGraphDefToFile(const string& name, GraphDef const& graph_def) {
string path = MakeUniquePath(name);
- TF_CHECK_OK(WriteTextProto(Env::Default(), path, graph_def));
+ Status status = WriteTextProto(Env::Default(), path, graph_def);
+ if (!status.ok()) {
+ VLOG(1) << "Failed to dump GraphDef to file: " << path << " : " << status;
+ path.clear();
+ path = "(unavailable)";
+ }
return path;
}
@@ -79,7 +84,13 @@ string DumpGraphToFile(const string& name, Graph const& graph,
string DumpFunctionDefToFile(const string& name, FunctionDef const& fdef) {
string path = MakeUniquePath(name);
- TF_CHECK_OK(WriteTextProto(Env::Default(), path, fdef));
+ Status status = WriteTextProto(Env::Default(), path, fdef);
+ if (!status.ok()) {
+ VLOG(1) << "Failed to dump FunctionDef to file: " << path << " : "
+ << status;
+ path.clear();
+ path = "(unavailable)";
+ }
return path;
}