summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2011-06-09 00:21:09 -0400
committerEliot Horowitz <eliot@10gen.com>2011-06-09 00:22:32 -0400
commit959500ba9977891b6a6d4736615d1ae5bf22d2c2 (patch)
tree5b7db438116a506fe530b7cb5e55fa82785d7a1e
parent817ee028fe6df84b7f342fefecb20f622b506287 (diff)
downloadmongo-959500ba9977891b6a6d4736615d1ae5bf22d2c2.tar.gz
try to fix numa segfault SERVER-3212
-rw-r--r--util/version.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/util/version.cpp b/util/version.cpp
index 35b64157c5d..e79e88d117e 100644
--- a/util/version.cpp
+++ b/util/version.cpp
@@ -110,22 +110,24 @@ namespace mongo {
File f;
f.open("/proc/self/numa_maps", /*read_only*/true);
- char line[100]; //we only need the first line
- f.read(0, line, sizeof(line));
-
- // just in case...
- line[98] = ' ';
- line[99] = '\0';
-
- // skip over pointer
- const char* space = strchr(line, ' ');
-
- if (!startsWith(space+1, "interleave")){
- cout << endl;
- cout << "** WARNING: You are running on a NUMA machine." << endl;
- cout << "** We suggest launching mongod like this to avoid performance problems:" << endl;
- cout << "** numactl --interleave=all mongod [other options]" << endl;
- warned = true;
+ if ( f.is_open() && ! f.bad() ) {
+ char line[100]; //we only need the first line
+ f.read(0, line, sizeof(line));
+
+ // just in case...
+ line[98] = ' ';
+ line[99] = '\0';
+
+ // skip over pointer
+ const char* space = strchr(line, ' ');
+
+ if (!startsWith(space+1, "interleave")){
+ cout << endl;
+ cout << "** WARNING: You are running on a NUMA machine." << endl;
+ cout << "** We suggest launching mongod like this to avoid performance problems:" << endl;
+ cout << "** numactl --interleave=all mongod [other options]" << endl;
+ warned = true;
+ }
}
}
#endif