buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
PATCH 1/1 buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
From: Pavel Modilaynen <[email protected]>
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
--- meta/classes/buildstats.bbclass | 5 +++++ 1 file changed, 5 insertions(+)
meta/classes/buildstats.bbclass +5 -0
@@ -31,6 +31,11 @@ def get_process_cputime(pid): i = f.readline().strip() if not i: break + if not ":" in i: + # one more extra line is appended (empty or containing "0") + # most probably due to race condition in kernel while + # updating IO stats + break i = i.split(": ") iostats[i[0]] = i[1] resources = resource.getrusage(resource.RUSAGE_SELF)
Signature · 1 line
2.15.1
ping
Quoted 39 lines · Martin Jansa
From: Pavel Modilaynen <[email protected]>
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
b26feaf51af55f17fad79dbd53dd3ec0a37c38ffSigned-off-by Pavel Modilaynen <[email protected]>Signed-off-by Daniel Lublin <[email protected]>Signed-off-by Ross Burton <[email protected]>Signed-off-by Martin Jansa <[email protected]>--- meta/classes/buildstats.bbclass | 5 +++++ 1 file changed, 5 insertions(+)meta/classes/buildstats. renamed from meta/classes/buildstats.bbclass +0
-0bbclass
index599a219984..415d2ee820100644meta/classes/buildstats.bbclass +5
-0@@ -31,6 +31,11 @@ def get_process_cputime(pid): i = f.readline().strip() if not i: break + if not ":" in i: + # one more extra line is appended (empty or containing "0") + # most probably due to race condition in kernel while + # updating IO stats + break i = i.split(": ") iostats[i[0]] = i[1]resources =
resource.getrusage(resource.RUSAGE_SELF)
--
2.15.1
Quoted 1 line · Martin Jansa
ping
I've queued this and the other morty patch in morty-next. Looks like we'll need to do further rounds of testing.
Cheers,
Richard