diff options
author | Pavel Modilaynen <pavelmn@axis.com> | 2017-02-24 11:22:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-01 23:27:10 +0000 |
commit | 010b368bc83f0b0ee748a860a67f8795e0b250b2 (patch) | |
tree | 3d909c0c3546204276201f06c17183ce522f3c75 /meta/classes/buildstats.bbclass | |
parent | 82f75730945f266ec0b4eda2ad0750359677f201 (diff) | |
download | poky-010b368bc83f0b0ee748a860a67f8795e0b250b2.tar.gz |
buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
There is some probability (depends on system load) to get empty
or line containing "0" as the last line while reading /proc/PID/io.
Avoid build failure by checking if line contains separator
":" before split.
(From OE-Core rev: b26feaf51af55f17fad79dbd53dd3ec0a37c38ff)
Signed-off-by: Pavel Modilaynen <pavelmn@axis.com>
Signed-off-by: Daniel Lublin <daniel@lublin.se>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildstats.bbclass')
-rw-r--r-- | meta/classes/buildstats.bbclass | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass index 8d7b5988e3..960653c704 100644 --- a/meta/classes/buildstats.bbclass +++ b/meta/classes/buildstats.bbclass | |||
@@ -31,6 +31,11 @@ def get_process_cputime(pid): | |||
31 | i = f.readline().strip() | 31 | i = f.readline().strip() |
32 | if not i: | 32 | if not i: |
33 | break | 33 | break |
34 | if not ":" in i: | ||
35 | # one more extra line is appended (empty or containing "0") | ||
36 | # most probably due to race condition in kernel while | ||
37 | # updating IO stats | ||
38 | break | ||
34 | i = i.split(": ") | 39 | i = i.split(": ") |
35 | iostats[i[0]] = i[1] | 40 | iostats[i[0]] = i[1] |
36 | resources = resource.getrusage(resource.RUSAGE_SELF) | 41 | resources = resource.getrusage(resource.RUSAGE_SELF) |