[Buildbot-commits] [Buildbot] #2427: Master requires restart sometimes if slave connection lost during graceful shutdown

Buildbot nobody at buildbot.net
Sun Jan 20 15:16:26 UTC 2013


#2427: Master requires restart sometimes if slave connection lost during graceful
shutdown
-------------------+--------------------
Reporter:  dank    |       Owner:
    Type:  defect  |      Status:  new
Priority:  minor   |   Milestone:  0.8.8
 Version:  0.8.7   |  Resolution:
Keywords:          |
-------------------+--------------------

Comment (by dustin):

 Try this?

 https://github.com/djmitche/buildbot/compare/bug2427

 {{{
 #!patch
 diff --git a/master/buildbot/process/build.py
 b/master/buildbot/process/build.py
 index cbd474b..4067900 100644
 --- a/master/buildbot/process/build.py
 +++ b/master/buildbot/process/build.py
 @@ -263,7 +263,7 @@ class Build(properties.PropertiesMixin):
              self.builder.builder_status.addPointEvent(["setupBuild",
                                                         "exception"])
              self.finished = True
 -            self.results = FAILURE
 +            self.results = EXCEPTION
              self.deferred = None
              d.callback(self)
              return d
 diff --git a/master/buildbot/process/builder.py
 b/master/buildbot/process/builder.py
 index bf94377..9df74f9 100644
 --- a/master/buildbot/process/builder.py
 +++ b/master/buildbot/process/builder.py
 @@ -368,6 +368,18 @@ class Builder(config.ReconfigurableServiceMixin,
              defer.returnValue(False)
              return

 +        # IMPORTANT: no yielding is allowed from here to the startBuild
 call!
 +
 +        # it's possible that we lost the slave remote between the ping
 above
 +        # and now.  If so, bail out.  The build.startBuild call below
 transfers
 +        # responsibility for monitoring this connection to the Build
 instance,
 +        # so this check ensures we hand off a working connection.
 +        if not slavebuilder.remote:
 +            log.msg("slave disappeared before build could start")
 +            run_cleanups()
 +            defer.returnValue(False)
 +            return
 +
          # let status know
          self.master.status.build_started(req.id, self.name, bs)

 @@ -377,10 +389,12 @@ class Builder(config.ReconfigurableServiceMixin,
          # will start the actual build process.  This is done with a fresh
          # Deferred since _startBuildFor should not wait until the build
 is
          # finished.
 -        d = build.startBuild(bs, self.expectations, slavebuilder)
 +        d = defer.maybeDeferred(build.startBuild,
 +                bs, self.expectations, slavebuilder)
          d.addCallback(self.buildFinished, slavebuilder, bids)
          # this shouldn't happen. if it does, the slave will be wedged
 -        d.addErrback(log.err)
 +        d.addErrback(log.err, 'while calling startBuild; this is a '
 +            'serious error - please file a bug at http://buildbot.net')

          # make sure the builder's status is represented correctly
          self.updateBigStatus()
 }}}

-- 
Ticket URL: <http://trac.buildbot.net/ticket/2427#comment:8>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list