Bug 9902 - the tmp/cache can get corrupted and prevent building
Summary: the tmp/cache can get corrupted and prevent building
Status: RESOLVED FIXED
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 2.2
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.2 M3
Assignee: Richard Purdie
QA Contact: Libertad
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2016-07-09 02:53 UTC by brian avery
Modified: 2016-07-29 15:47 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description brian avery 2016-07-09 02:53:23 UTC
The tmp/cache file can get into a bad state where subsequent bitbake calls generate a traceback. Afaik, this only happens when also running toaster.

Workaround: Removing tmp/cache forces bitbake to regenerate the cache and there are no tracebacks.

Commitish: master/d6abd7559512b3de980b2495e2f5f5db25a4afed

To reproduce:
oe-init & start toaster, cli build , stop toaster, start toaster, cli build...

-------
  . ~/src/intel/myBugs/poky/oe-init-build-env
  . toaster start
  bitbake zlib
  . toaster  stop
  . toaster  start
  bitbake bash
  . toaster stop
  . toaster webport=0.0.0.0:8005 start
  bitbake core-image-minimal
--------



The traceback:
$ bitbake core-image-minimal
NOTE: ToasterUI waiting for events
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.31.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "universal"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "2.1+snapshot-20160709"
TUNE_FEATURES     = "m32 i586"
TARGET_FPU        = ""
meta              
meta-poky         
meta-yocto-bsp    = "master:d6abd7559512b3de980b2495e2f5f5db25a4afed"

ERROR: 
Traceback (most recent call last):
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/ui/toasterui.py", line 246, in main
    buildinfohelper.store_started_build(event, build_log_file_path)
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/ui/buildinfohelper.py", line 1009, in store_started_build
    build_information = self._get_build_information(build_log_path)
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/ui/buildinfohelper.py", line 893, in _get_build_information
    build_info['distro'] = self.server.runCommand(["getVariable", "DISTRO"])[0]
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/server/process.py", line 61, in runCommand
    bb.fatal("Gave up; Too many tries: timeout while attempting to communicate with bitbake server")
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/__init__.py", line 104, in fatal
    raise BBHandledException()
bb.BBHandledException

ERROR: An uncaught exception occured in runqueue, please see the failure below:
ERROR: Running idle function
Traceback (most recent call last):
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/server/process.py", line 142, in ProcessServer.idle_commands(delay=0.1, fds=[<multiprocessing.connection.Connection object at 0x7fb78a68b6d8>, <multiprocessing.connection.Connection object at 0x7fb7892005f8>]):
                 try:
    >                retval = function(self, data, False)
                     if retval is False:
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/cooker.py", line 1354, in buildTargetsIdle(server=<ProcessServer(ProcessServer-1, started)>, rq=<bb.runqueue.RunQueue object at 0x7fb78410a2b0>, abort=False):
                 try:
    >                retval = rq.execute_runqueue()
                 except runqueue.TaskFailure as exc:
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/runqueue.py", line 1210, in RunQueue.execute_runqueue():
             try:
    >            return self._execute_runqueue()
             except bb.runqueue.TaskFailure:
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/runqueue.py", line 1144, in RunQueue._execute_runqueue():
                     # needs it
    >                depgraph = self.cooker.buildDependTree(self, self.rqdata.taskData)
                     self.rqdata.init_progress_reporter.next_stage()
  File "/big/src/intel/myBugs/poky/bitbake/lib/bb/cooker.py", line 741, in BBCooker.buildDependTree(rq=<bb.runqueue.RunQueue object at 0x7fb78410a2b0>, taskdata=<bb.taskdata.TaskData object at 0x7fb786863940>):
                     for ei in extra_info:
    >                    depend_tree["pn"][pn][ei] = vars(self.recipecache)[ei][fn]
     
KeyError: 'virtual:native:/big/src/intel/myBugs/poky/meta/recipes-extended/xz/xz_5.2.2.bb'
Comment 1 Richard Purdie 2016-07-21 15:56:40 UTC
As usually seems to be the case, there are multiple things going on here. For some reason the extra 'HOB' cache is getting corrupted on disk. When the system loads this, it basically ignores the errors and loads a partial cache. We then have missing items, hence the crash below.

I have a patch which makes the invalid cache trigger a reparse which is what it should do, i.e. sanely recover. Sadly when I "bitbake bash" with my fix, I see:

NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 744 tasks of which 744 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
ERROR: maximum recursion depth exceeded
Traceback (most recent call last):
  File "/media/build1/poky/bitbake/lib/bb/ui/toasterui.py", line 377, in main
    buildinfohelper.close(errorcode)
  File "/media/build1/poky/bitbake/lib/bb/ui/buildinfohelper.py", line 1517, in close
    self.store_log_event(tempevent)

[snip screenfuls of repeats]

    self.store_log_event(tempevent)
  File "/media/build1/poky/bitbake/lib/bb/ui/buildinfohelper.py", line 1483, in store_log_event
    logger.debug(1, "buildinfohelper: Saving stored event %s " % tempevent)
RecursionError: maximum recursion depth exceeded

WARNING: Return value is 1

So there looks to be some other toaster issue here and also the question of how the cache gets corrupted in the first place.
Comment 2 Ross Burton 2016-07-26 16:33:17 UTC
Fixed in bitbake 51843d8f2bbe2e54db7593ca61984abe70423ef6.