<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>10787</bug_id>
          
          <creation_ts>2016-12-12 11:36:27 +0000</creation_ts>
          <short_desc>Resolve autobuilder exceptions due to finishing steps before they&apos;ve started</short_desc>
          <delta_ts>2017-06-21 18:53:03 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>5</classification_id>
          <classification>Infrastructure</classification>
          <product>AutoBuilder</product>
          <component>autobuilder</component>
          <version>2.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.3 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Joshua Lock">joshuagloe</reporter>
          <assigned_to name="Joshua Lock">joshuagloe</assigned_to>
          <cc>infras.ab.watcher</cc>
    
    <cc>Infras.watcher</cc>
    
    <cc>jose.perez.carranza</cc>
    
    <cc>pidge</cc>
          
          <qa_contact name="Juan Ramos">juan.fernandox.ramos.frayle</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>69029</commentid>
    <comment_count>0</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-12-12 11:36:27 +0000</bug_when>
    <thetext>Several buildsteps in the yocto-autobuilder call self.finished() and/or self.build.stopBuild() *before* the Command.start() has been called.

This results in an exception which doesn&apos;t (noticeably) have an effect on the build but does clutter the autobuilders logs, making it harder to find errors which are affecting builds.

Example of the traceback:

2016-12-12 03:09:35+0000 [-] BuildStep.startStep exception in .start
2016-12-12 03:09:35+0000 [-] BuildStep.failed; traceback follows
        Traceback (most recent call last):
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py&quot;, line 551, in _runCallbacks
            current.result = callback(current.result, *args, **kw)
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py&quot;, line 1187, in unwindGenerator
            return _inlineCallbacks(None, gen, Deferred())
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py&quot;, line 1045, in _inlineCallbacks
            result = g.send(result)
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/process/buildstep.py&quot;, line 605, in _startStep_3
            result = yield defer.maybeDeferred(self.start)
        --- &lt;exception caught here&gt; ---
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py&quot;, line 134, in maybeDeferred
            result = f(*args, **kw)
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/autobuilder/buildsteps/ResolveLayerHead.py&quot;, line 57, in start
            self.command = cmd
        exceptions.UnboundLocalError: local variable &apos;cmd&apos; referenced before assignment

2016-12-12 03:09:35+0000 [-] exception during failure processing
        Traceback (most recent call last):
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py&quot;, line 1187, in unwindGenerator
            return _inlineCallbacks(None, gen, Deferred())
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/internet/defer.py&quot;, line 1043, in _inlineCallbacks
            result = result.throwExceptionIntoGenerator(g)
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/failure.py&quot;, line 382, in throwExceptionIntoGenerator
            return g.throw(self.type, self.value, self.tb)
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/process/buildstep.py&quot;, line 610, in _startStep_3
            self.failed(Failure())
        --- &lt;exception caught here&gt; ---
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/process/buildstep.py&quot;, line 686, in failed
            self.progress.finish()
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/status/progress.py&quot;, line 85, in finish
            self.buildProgress.stepFinished(self.name)
          File &quot;/home/pokybuild/yocto-autobuilder/lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/status/progress.py&quot;, line 165, in stepFinished
            assert(stepname not in self.finishedSteps)
        exceptions.AssertionError:</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69225</commentid>
    <comment_count>1</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-12-20 13:57:46 +0000</bug_when>
    <thetext>BuildStep.finished()[1] states &quot;The step should not perform any additional processing after calling this method.&quot; yet many of our build steps call finished() before they call start()[2]

1. http://docs.buildbot.net/0.8.8/developer/cls-buildsteps.html#buildbot.process.buildstep.BuildStep.finished
2. http://docs.buildbot.net/0.8.8/developer/cls-buildsteps.html#buildbot.process.buildstep.BuildStep.start</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>69229</commentid>
    <comment_count>2</comment_count>
    <who name="Joshua Lock">joshuagloe</who>
    <bug_when>2016-12-20 15:18:00 +0000</bug_when>
    <thetext>I&apos;ve identified a few patterns to avoid calling start() after finished() has been called without significantly refactoring the affected buildsteps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74438</commentid>
    <comment_count>3</comment_count>
    <who name="Juan Ramos">juan.fernandox.ramos.frayle</who>
    <bug_when>2017-06-21 18:53:03 +0000</bug_when>
    <thetext>Asked to Joshua, he said it&apos;s ok to change this bug to Verified.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>