[gnome-continuous-yocto/gnomeostree-3.28-rocko: 4856/8267] buildstats.bbclass: Avoid index exception in /proc/PID/io parsing



commit 010b368bc83f0b0ee748a860a67f8795e0b250b2
Author: Pavel Modilaynen <pavelmn axis com>
Date:   Fri Feb 24 11:22:20 2017 +0100

    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>

 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 8d7b598..960653c 100644
--- a/meta/classes/buildstats.bbclass
+++ b/meta/classes/buildstats.bbclass
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]