diff options
author | Pavel Modilaynen <pavelmn@axis.com> | 2018-01-31 19:10:38 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-03-14 07:55:53 -0700 |
commit | d5c9d46de343d8432310ebb6b0fcb707dee654ec (patch) | |
tree | 3950594a570dd4178df18db8118b9374300d87e1 /meta/classes/buildstats.bbclass | |
parent | a9cf5f2a6e827d0e50a5931cceea0b0b03066b1a (diff) | |
download | poky-d5c9d46de343d8432310ebb6b0fcb707dee654ec.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.
Backport from pyro commit b26feaf51af55f17fad79dbd53dd3ec0a37c38ff
(From OE-Core rev: 31a098032eb82eb40eaa3952de4d29ab472e368a)
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: Martin Jansa <Martin.Jansa@gmail.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 599a219984..415d2ee820 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) |