| Summary: | toaster: Infinite loop error handling issues | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Toaster | Reporter: | Richard Purdie <richard.purdie> |
| Component: | toaster | Assignee: | Alexandru Damian <alexandru.damian> |
| Status: | VERIFIED FIXED | QA Contact: | Mihail Stanciu <stanciux.mihail> |
| Severity: | normal | ||
| Priority: | Medium+ | CC: | alexandru.damian, belen.barros.pena, cristiana.voicu, jessica.zhang, stanciux.mihail |
| Version: | unspecified | ||
| Target Milestone: | 1.8 M4 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |
Possible fix: From 13172dbf979276c39bd62c7144d4fcd6d09bf09e Mon Sep 17 00:00:00 2001 From: Richard Purdie <richard.purdie@linuxfoundation.org> Date: Thu, 5 Mar 2015 11:16:55 +0000 Subject: event: Improve exception handling? Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index fec6a05..62a8f4f 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -74,17 +74,17 @@ def execute_handler(name, handler, event, d): event.data = d try: ret = handler(event) - except (bb.parse.SkipRecipe, bb.BBHandledException): + except bb.parse.SkipRecipe: raise + except bb.BBHandledException: + pass except Exception: etype, value, tb = sys.exc_info() logger.error("Execution of event handler '%s' failed" % name, exc_info=(etype, value, tb.tb_next)) - raise except SystemExit as exc: if exc.code != 0: - logger.error("Execution of event handler '%s' failed" % name) - raise + logger.error("Execution of event handler '%s' failed (exit code %s)" % (name, exc.code)) finally: del event.data -- cgit v0.10.2 Good spot for the bug ! Thanks for the patch - I want to see if we can handle it in ToasterUI, or how does it impact the managed mode building. Moving the bug to accepted. You can likely make the class more forgiving but I think there is also a general problem, if an event handler raises an exception, cooker can be left looping infinitely. Alternative patch pushed for review at: http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=adamian/20150305_review&id=a75e421a6c5857629b44c7b7dd92ae00a0e46677 Merged in master as 7d9dd125f1207d4b1751763d9fd33d8ed1d74498 Verified on master: 33558eacc8a2d3dce3396b9ab2fd0773ac5076bc |
If you change buildhistory with something like: --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass @@ -371,16 +371,16 @@ buildhistory_get_installed() { rm $1/depends.tmp # Produce installed package sizes list - printf "" > $1/installed-package-sizes.tmp - cat $pkgcache | while read pkg pkgfile pkgarch - do - size=`oe-pkgdata-util -p ${PKGDATA_DIR} read-value "PKGSIZE" ${pkg}_${pkgarch}` - if [ "$size" != "" ] ; then - echo "$size $pkg" >> $1/installed-package-sizes.tmp - fi - done - cat $1/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > $1/installed-package-sizes.txt - rm $1/installed-package-sizes.tmp + #printf "" > $1/installed-package-sizes.tmp + #cat $pkgcache | while read pkg pkgfile pkgarch + #do + # size=`oe-pkgdata-util -p ${PKGDATA_DIR} read-value "PKGSIZE" ${pkg}_${pkgarch}` + # if [ "$size" != "" ] ; then + # echo "$size $pkg" >> $1/installed-package-sizes.tmp + # fi + #done + #cat $1/installed-package-sizes.tmp | sort -n -r | awk '{print $1 "\tKiB " $2}' > $1/installed-package-sizes.txt + #rm $1/installed-package-sizes.tmp then the installed-packages-sizes.txt file isn't generated. If you then build an image with toaster running, it enters an infinite loop when it can't find the file: ERROR: Execution of event handler 'toaster_buildhistory_dump' failed Traceback (most recent call last): File "toaster_buildhistory_dump(e)", line 20, in toaster_buildhistory_dump(e=<bb.event.BuildCompleted object at 0x7f1a92de7e50>) IOError: [Errno 2] No such file or directory: '/media/build1/poky/build/buildhistory/images/qemux86/glibc/core-image-sato/installed-package-sizes.txt' Keyboard Interrupt, closing down... NOTE: Tasks Summary: Attempted 5550 tasks of which 5271 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory ERROR: Execution of event handler 'toaster_buildhistory_dump' failed Traceback (most recent call last): File "toaster_buildhistory_dump(e)", line 20, in toaster_buildhistory_dump(e=<bb.event.BuildCompleted object at 0x7f1a94186090>) IOError: [Errno 2] No such file or directory: '/media/build1/poky/build/buildhistory/images/qemux86/glibc/core-image-sato/installed-package-sizes.txt' NOTE: Tasks Summary: Attempted 5550 tasks of which 5271 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory ERROR: Execution of event handler 'toaster_buildhistory_dump' failed Traceback (most recent call last): File "toaster_buildhistory_dump(e)", line 20, in toaster_buildhistory_dump(e=<bb.event.BuildCompleted object at 0x7f1a92e34850>) IOError: [Errno 2] No such file or directory: '/media/build1/poky/build/buildhistory/images/qemux86/glibc/core-image-sato/installed-package-sizes.txt' I'm don't mind it breaking if I make changes like this on my own, that is fair enough but the error handling needs improving do it doesn't loop infinitely.