[oe-commits] [openembedded-core] 02/03: buildstats.bbclass: Avoid index exception in /proc/PID/io parsing

git at git.openembedded.org git at git.openembedded.org
Thu Mar 8 02:02:45 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch morty-next
in repository openembedded-core.

commit 31a098032eb82eb40eaa3952de4d29ab472e368a
Author: Pavel Modilaynen <pavelmn at axis.com>
AuthorDate: Wed Jan 31 19:10:38 2018 +0000

    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
    
    Signed-off-by: Pavel Modilaynen <pavelmn at axis.com>
    Signed-off-by: Daniel Lublin <daniel at lublin.se>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/buildstats.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/meta/classes/buildstats.bbclass b/meta/classes/buildstats.bbclass
index 599a219..415d2ee 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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list