processes: Fix 'delay_rate' race condition
authorPavel Rochnyack <pavel2000@ngs.ru>
Wed, 19 Dec 2018 12:57:04 +0000 (19:57 +0700)
committerPavel Rochnyack <pavel2000@ngs.ru>
Wed, 19 Dec 2018 12:57:04 +0000 (19:57 +0700)
When ts_delay_by_tgid() failed (for example, when observable process
terminates), `ps->delay` fields are not updated and remain set to zero.

This interpreted as counter overflow and produces spike.

Issue: #3026

src/processes.c

index ce4cc65..171dde9 100644 (file)
@@ -587,7 +587,8 @@ static void ps_list_add(const char *name, const char *cmdline,
                       entry->cpu_system_counter);
 
 #if HAVE_LIBTASKSTATS
-    ps_update_delay(ps, pse, entry);
+    if (entry->has_delay)
+      ps_update_delay(ps, pse, entry);
 #endif
   }
 }