Skip to content

Commit

Permalink
Crash was repoted in 3.1.1.0 build 51 with qed. The TB's pointed
Browse files Browse the repository at this point in the history
to a TaskTrigger that gets CpuLoadInfo. The CpuLoadInfo is defined in
base. We suspect an issue in the ifstream operation. Adding asserts
to confirm the same. Its not reproducible consistently.
Closes-Bug:#1656139

Change-Id: Icfe671d55cc99ddb270f292d80d9621b6ebab5cb
  • Loading branch information
arvindvis committed Jan 21, 2017
1 parent cd1e31a commit 3670d8a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/base/cpuinfo.cc
Expand Up @@ -22,6 +22,12 @@

using namespace boost;

static void error_check(std::ifstream &file) {
assert(file.is_open());
assert(!file.fail());
assert(!file.bad());
}

static uint32_t NumCpus() {
static uint32_t count = 0;

Expand All @@ -35,6 +41,7 @@ static uint32_t NumCpus() {
return count;
#else
std::ifstream file("/proc/cpuinfo");
error_check(file);
std::string content((std::istreambuf_iterator<char>(file)),
std::istreambuf_iterator<char>());
// Create a find_iterator
Expand Down Expand Up @@ -75,6 +82,7 @@ static void ProcessMemInfo(ProcessMemInfo &info) {
return;
#else
std::ifstream file("/proc/self/status");
error_check(file);
bool vmsize = false;
bool peak = false;
bool rss = false;
Expand Down Expand Up @@ -103,6 +111,7 @@ static void ProcessMemInfo(ProcessMemInfo &info) {

static void SystemMemInfo(SystemMemInfo &info) {
std::ifstream file("/proc/meminfo");
error_check(file);
std::string tmp;
// MemTotal: 132010576 kB
file >> tmp; file >> info.total; file >> tmp;
Expand Down

0 comments on commit 3670d8a

Please sign in to comment.