summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-03 22:01:25 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-06 14:39:29 +0000
commitccd7f12b1c95b546ef79204ad0832b88a595d0ea (patch)
tree04cd240e7ca62459392b8483ba3f631574524fc2 /bitbake/lib/bb/ui/knotty.py
parent109ef2e5c4161a2c0ac58bede3daa48c7b4881ec (diff)
downloadpoky-ccd7f12b1c95b546ef79204ad0832b88a595d0ea.tar.gz
bitbake: knotty/uihelper: Switch from pids to tids for Task event management
We've seen cases where a task can execute with a given pid, complete and a new task can start using the same pid before the UI handler has had time to adapt. Traceback (most recent call last): File "/home/pokybuild/yocto-worker/qemux86-alt/build/bitbake/lib/bb/ui/knotty.py", line 484, in main helper.eventHandler(event) File "/home/pokybuild/yocto-worker/qemux86-alt/build/bitbake/lib/bb/ui/uihelper.py", line 30, in eventHandler del self.running_tasks[event.pid] KeyError: 13490 This means using pids to match up events on the UI side is a bad idea. Change the code to use task ids instead. There is a small amount of fuzzy matching for the progress information since there is no task information there and we don't want the overhead of a task ID in every event, however since pid reuse is unlikely, we can live with a progress bar not quite working properly in a corner case like this. [YOCTO #13667] (Bitbake rev: e427eafa1bb04008d12100ccc5c862122bba53e0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r--bitbake/lib/bb/ui/knotty.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 35736ade03..bd9911cf6f 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -255,19 +255,19 @@ class TerminalFilter(object):
255 start_time = activetasks[t].get("starttime", None) 255 start_time = activetasks[t].get("starttime", None)
256 if not pbar or pbar.bouncing != (progress < 0): 256 if not pbar or pbar.bouncing != (progress < 0):
257 if progress < 0: 257 if progress < 0:
258 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2, resize_handler=self.sigwinch_handle) 258 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2, resize_handler=self.sigwinch_handle)
259 pbar.bouncing = True 259 pbar.bouncing = True
260 else: 260 else:
261 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4, resize_handler=self.sigwinch_handle) 261 pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4, resize_handler=self.sigwinch_handle)
262 pbar.bouncing = False 262 pbar.bouncing = False
263 activetasks[t]["progressbar"] = pbar 263 activetasks[t]["progressbar"] = pbar
264 tasks.append((pbar, progress, rate, start_time)) 264 tasks.append((pbar, progress, rate, start_time))
265 else: 265 else:
266 start_time = activetasks[t].get("starttime", None) 266 start_time = activetasks[t].get("starttime", None)
267 if start_time: 267 if start_time:
268 tasks.append("%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), t)) 268 tasks.append("%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), activetasks[t]["pid"]))
269 else: 269 else:
270 tasks.append("%s (pid %s)" % (activetasks[t]["title"], t)) 270 tasks.append("%s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]))
271 271
272 if self.main.shutdown: 272 if self.main.shutdown:
273 content = "Waiting for %s running tasks to finish:" % len(activetasks) 273 content = "Waiting for %s running tasks to finish:" % len(activetasks)
@@ -517,8 +517,8 @@ def main(server, eventHandler, params, tf = TerminalFilter):
517 continue 517 continue
518 518
519 # Prefix task messages with recipe/task 519 # Prefix task messages with recipe/task
520 if event.taskpid in helper.running_tasks and event.levelno != format.PLAIN: 520 if event.taskpid in helper.pidmap and event.levelno != format.PLAIN:
521 taskinfo = helper.running_tasks[event.taskpid] 521 taskinfo = helper.running_tasks[helper.pidmap[event.taskpid]]
522 event.msg = taskinfo['title'] + ': ' + event.msg 522 event.msg = taskinfo['title'] + ': ' + event.msg
523 if hasattr(event, 'fn'): 523 if hasattr(event, 'fn'):
524 event.msg = event.fn + ': ' + event.msg 524 event.msg = event.fn + ': ' + event.msg