Openembedded Core Discussions
 help / color / mirror / Atom feed
* [morty][PATCH] buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
@ 2018-01-31 19:10 Martin Jansa
  2018-03-04 11:41 ` Martin Jansa
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Jansa @ 2018-01-31 19:10 UTC (permalink / raw)
  To: openembedded-core; +Cc: Daniel Lublin, Pavel Modilaynen

From: Pavel Modilaynen <pavelmn@axis.com>

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@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>
---
 meta/classes/buildstats.bbclass | 5 +++++
 1 file changed, 5 insertions(+)

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):
                 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [morty][PATCH] buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
  2018-01-31 19:10 [morty][PATCH] buildstats.bbclass: Avoid index exception in /proc/PID/io parsing Martin Jansa
@ 2018-03-04 11:41 ` Martin Jansa
  2018-03-04 13:20   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Jansa @ 2018-03-04 11:41 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer
  Cc: Daniel Lublin, Pavel Modilaynen

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

ping

On Wed, Jan 31, 2018 at 8:10 PM, Martin Jansa <martin.jansa@gmail.com>
wrote:

> From: Pavel Modilaynen <pavelmn@axis.com>
>
> 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@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>
> ---
>  meta/classes/buildstats.bbclass | 5 +++++
>  1 file changed, 5 insertions(+)
>
> 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):
>                  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
>
>

[-- Attachment #2: Type: text/html, Size: 2376 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [morty][PATCH] buildstats.bbclass: Avoid index exception in /proc/PID/io parsing
  2018-03-04 11:41 ` Martin Jansa
@ 2018-03-04 13:20   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2018-03-04 13:20 UTC (permalink / raw)
  To: Martin Jansa, Patches and discussions about the oe-core layer
  Cc: Daniel Lublin, Pavel Modilaynen

On Sun, 2018-03-04 at 12:41 +0100, Martin Jansa wrote:
> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-04 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 19:10 [morty][PATCH] buildstats.bbclass: Avoid index exception in /proc/PID/io parsing Martin Jansa
2018-03-04 11:41 ` Martin Jansa
2018-03-04 13:20   ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox