Bug 772467: Expire old duplicate slave connections eventually. r=dustin production-0.8 FENNEC_10_0_6esr_BUILD1 FENNEC_10_0_6esr_RELEASE FENNEC_14_0_1_BUILD1 FENNEC_14_0_1_BUILD2 FENNEC_14_0_1_RELEASE FENNEC_14_0_2_BUILD1 FENNEC_14_0_2_BUILD2 FENNEC_14_0_2_RELEASE FENNEC_15_0_1_BUILD1 FENNEC_15_0_1_BUILD2 FENNEC_15_0_1_RELEASE FENNEC_15_0_BUILD1 FENNEC_15_0_RELEASE FENNEC_15_0b1_BUILD1 FENNEC_15_0b1_BUILD2 FENNEC_15_0b1_RELEASE FENNEC_15_0b2_BUILD1 FENNEC_15_0b2_RELEASE FENNEC_15_0b3_BUILD1 FENNEC_15_0b3_RELEASE FENNEC_15_0b4_BUILD1 FENNEC_15_0b4_RELEASE FENNEC_15_0b5_BUILD1 FENNEC_15_0b5_RELEASE FENNEC_15_0b6_BUILD1 FENNEC_15_0b6_RELEASE FENNEC_15_0b7_BUILD1 FENNEC_15_0b7_RELEASE FENNEC_16_0_1_BUILD1 FENNEC_16_0_1_RELEASE FENNEC_16_0_2_BUILD1 FENNEC_16_0_2_RELEASE FENNEC_16_0_BUILD1 FENNEC_16_0_RELEASE FENNEC_16_0b1_BUILD1 FENNEC_16_0b1_RELEASE FENNEC_16_0b2_BUILD1 FENNEC_16_0b2_BUILD2 FENNEC_16_0b2_RELEASE FENNEC_16_0b3_BUILD1 FENNEC_16_0b3_RELEASE FENNEC_16_0b4_BUILD1 FENNEC_16_0b4_RELEASE FENNEC_16_0b5_BUILD1 FENNEC_16_0b5_RELEASE FENNEC_16_0b6_BUILD1 FENNEC_16_0b6_RELEASE FENNEC_17_0_1_BUILD1 FENNEC_17_0_1_RELEASE FENNEC_17_0_BUILD1 FENNEC_17_0_RELEASE FENNEC_17_0b1_BUILD1 FENNEC_17_0b1_BUILD2 FENNEC_17_0b1_RELEASE FENNEC_17_0b2_BUILD1 FENNEC_17_0b2_BUILD2 FENNEC_17_0b2_RELEASE FENNEC_17_0b3_BUILD1 FENNEC_17_0b3_RELEASE FENNEC_17_0b4_BUILD1 FENNEC_17_0b4_RELEASE FENNEC_17_0b5_BUILD1 FENNEC_17_0b5_RELEASE FENNEC_17_0b6_BUILD1 FENNEC_17_0b6_BUILD2 FENNEC_17_0b6_RELEASE FENNEC_17_0b7_BUILD1 FENNEC_17_0b7_RELEASE FENNEC_18_0b1_BUILD1 FENNEC_18_0b1_RELEASE FENNEC_18_0b2_BUILD1 FENNEC_18_0b2_RELEASE FENNEC_18_0b3_BUILD1 FENNEC_18_0b3_RELEASE FIREFOX_10_0_10esr_BUILD1 FIREFOX_10_0_10esr_RELEASE FIREFOX_10_0_11esr_BUILD1 FIREFOX_10_0_11esr_RELEASE FIREFOX_10_0_6esr_BUILD1 FIREFOX_10_0_6esr_RELEASE FIREFOX_10_0_7esr_BUILD1 FIREFOX_10_0_7esr_RELEASE FIREFOX_10_0_8esr_BUILD1 FIREFOX_10_0_8esr_RELEASE FIREFOX_10_0_9esr_BUILD1 FIREFOX_10_0_9esr_RELEASE FIREFOX_14_0_1_BUILD1 FIREFOX_14_0_1_RELEASE FIREFOX_15_0_1_BUILD1 FIREFOX_15_0_1_RELEASE FIREFOX_15_0_BUILD1 FIREFOX_15_0_RELEASE FIREFOX_15_0b1_BUILD1 FIREFOX_15_0b1_RELEASE FIREFOX_15_0b2_BUILD1 FIREFOX_15_0b2_RELEASE FIREFOX_15_0b3_BUILD1 FIREFOX_15_0b3_RELEASE FIREFOX_15_0b4_BUILD1 FIREFOX_15_0b4_RELEASE FIREFOX_15_0b5_BUILD1 FIREFOX_15_0b5_RELEASE FIREFOX_15_0b6_BUILD1 FIREFOX_15_0b6_RELEASE FIREFOX_16_0_1_BUILD1 FIREFOX_16_0_1_RELEASE FIREFOX_16_0_2_BUILD1 FIREFOX_16_0_2_RELEASE FIREFOX_16_0_BUILD1 FIREFOX_16_0_RELEASE FIREFOX_16_0b1_BUILD1 FIREFOX_16_0b1_RELEASE FIREFOX_16_0b2_BUILD1 FIREFOX_16_0b2_RELEASE FIREFOX_16_0b3_BUILD1 FIREFOX_16_0b3_RELEASE FIREFOX_16_0b4_BUILD1 FIREFOX_16_0b4_RELEASE FIREFOX_16_0b5_BUILD1 FIREFOX_16_0b5_RELEASE FIREFOX_16_0b6_BUILD1 FIREFOX_16_0b6_RELEASE FIREFOX_17_0_1_BUILD1 FIREFOX_17_0_1_RELEASE FIREFOX_17_0_1esr_BUILD1 FIREFOX_17_0_1esr_RELEASE FIREFOX_17_0_BUILD1 FIREFOX_17_0_BUILD2 FIREFOX_17_0_RELEASE FIREFOX_17_0b1_BUILD1 FIREFOX_17_0b1_BUILD2 FIREFOX_17_0b1_RELEASE FIREFOX_17_0b2_BUILD1 FIREFOX_17_0b2_RELEASE FIREFOX_17_0b3_BUILD1 FIREFOX_17_0b3_RELEASE FIREFOX_17_0b4_BUILD1 FIREFOX_17_0b4_RELEASE FIREFOX_17_0b5_BUILD1 FIREFOX_17_0b5_RELEASE FIREFOX_17_0b6_BUILD1 FIREFOX_17_0b6_RELEASE FIREFOX_17_0esr_BUILD1 FIREFOX_17_0esr_BUILD2 FIREFOX_17_0esr_RELEASE FIREFOX_18_0b1_BUILD1 FIREFOX_18_0b1_RELEASE FIREFOX_18_0b2_BUILD1 FIREFOX_18_0b2_RELEASE FIREFOX_18_0b3_BUILD1 FIREFOX_18_0b3_RELEASE THUNDERBIRD_10_0_10esr_BUILD1 THUNDERBIRD_10_0_10esr_RELEASE THUNDERBIRD_10_0_11esr_BUILD1 THUNDERBIRD_10_0_11esr_RELEASE THUNDERBIRD_10_0_6esr_BUILD1 THUNDERBIRD_10_0_6esr_RELEASE THUNDERBIRD_10_0_7esr_BUILD1 THUNDERBIRD_10_0_7esr_RELEASE THUNDERBIRD_10_0_8esr_BUILD1 THUNDERBIRD_10_0_8esr_RELEASE THUNDERBIRD_10_0_9esr_BUILD1 THUNDERBIRD_10_0_9esr_RELEASE THUNDERBIRD_14_0_BUILD1 THUNDERBIRD_14_0_RELEASE THUNDERBIRD_15_0_1_BUILD1 THUNDERBIRD_15_0_1_RELEASE THUNDERBIRD_15_0_BUILD1 THUNDERBIRD_15_0_RELEASE THUNDERBIRD_15_0b1_BUILD1 THUNDERBIRD_15_0b1_RELEASE THUNDERBIRD_15_0b2_BUILD1 THUNDERBIRD_15_0b2_RELEASE THUNDERBIRD_15_0b3_BUILD1 THUNDERBIRD_15_0b3_RELEASE THUNDERBIRD_15_0b4_BUILD1 THUNDERBIRD_15_0b4_RELEASE THUNDERBIRD_15_0b5_BUILD1 THUNDERBIRD_15_0b5_RELEASE THUNDERBIRD_16_0_1_BUILD1 THUNDERBIRD_16_0_1_RELEASE THUNDERBIRD_16_0_2_BUILD1 THUNDERBIRD_16_0_2_RELEASE THUNDERBIRD_16_0_BUILD1 THUNDERBIRD_16_0_RELEASE THUNDERBIRD_16_0b1_BUILD1 THUNDERBIRD_16_0b1_RELEASE THUNDERBIRD_16_0b2_BUILD1 THUNDERBIRD_16_0b2_RELEASE THUNDERBIRD_16_0b3_BUILD1 THUNDERBIRD_16_0b3_RELEASE THUNDERBIRD_16_0b4_BUILD1 THUNDERBIRD_16_0b4_RELEASE THUNDERBIRD_17_0_BUILD2 THUNDERBIRD_17_0_RELEASE THUNDERBIRD_17_0b1_BUILD1 THUNDERBIRD_17_0b1_RELEASE THUNDERBIRD_17_0b2_BUILD1 THUNDERBIRD_17_0b2_RELEASE THUNDERBIRD_17_0b3_BUILD1 THUNDERBIRD_17_0b3_RELEASE THUNDERBIRD_17_0esr_BUILD2 THUNDERBIRD_17_0esr_BUILD3 THUNDERBIRD_17_0esr_BUILD4 THUNDERBIRD_17_0esr_RELEASE THUNDERBIRD_18_0b1_BUILD1 THUNDERBIRD_18_0b1_RELEASE
authorChris AtLee <catlee@mozilla.com>
Tue, 10 Jul 2012 15:44:25 -0400
branchproduction-0.8
changeset 560 bd4812420e639f5d19cebc2c1d9f50ad7fbac409
parent 511 3268262c697b632511dc6e3412605eaa9a33e0e5
child 672 41fc8a9db7a0b0233c00d887b83cc237f8904c7e
push id329
push usercatlee@mozilla.com
push dateThu, 12 Jul 2012 17:42:44 +0000
reviewersdustin
bugs772467
Bug 772467: Expire old duplicate slave connections eventually. r=dustin
master/buildbot/master.py
master/buildbot/monkey.py
--- a/master/buildbot/master.py
+++ b/master/buildbot/master.py
@@ -335,18 +335,35 @@ class BotMaster(service.MultiService):
             # report the IP addresses of both so someone can resolve the
             # squabble
             old_tport = sl.slave.broker.transport
             new_tport = mind.broker.transport
             log.msg("old slave was connected from", old_tport.getPeer())
             log.msg("new slave is from", new_tport.getPeer())
 
             # ping the old slave.  If this kills it, then the new slave will connect
-            # again and everyone will be happy.
+            # again and everyone will be happy.  If we don't hear back from the
+            # slave in a reasonable amount of time, then kill the old slave too
+            timeout_delay = 30
+            def timeout():
+                # If our transport hasn't changed, then we can disconnect
+                # If the transport _has_ changed, then we were probably able to
+                # reconnect, perhaps from a previously queued-up delayedCall.
+                # In anycase, don't disconnect the new transport if it's
+                # different from what was here before.
+                if sl.slave and old_tport.getPeer() == sl.slave.broker.transport.getPeer():
+                    log.msg("didn't hear back from slave in %i seconds; killing existing connection" % timeout_delay)
+                    sl.disconnect()
+
+            killswitch = reactor.callLater(timeout_delay, timeout)
             d = sl.slave.callRemote("print", "master got a duplicate connection; keeping this one")
+            def cb(_):
+                if killswitch.active():
+                    killswitch.cancel()
+            d.addCallback(cb)
 
             # now return a dummy avatar and kill the new connection in 5
             # seconds, thereby giving the ping a bit of time to kill the old
             # connection, if necessary
             def kill():
                 log.msg("killing new slave on", new_tport.getPeer())
                 new_tport.loseConnection()
             reactor.callLater(5, kill)
--- a/master/buildbot/monkey.py
+++ b/master/buildbot/monkey.py
@@ -8,17 +8,17 @@ def monkeypatch_twisted_cbLogin():
     from twisted.python.versions import Version
 
     # This patch is known to work in versions 8.2.0 -> 11.0.0
     # If your version is outside this range, but this monkey patch still
     # applies, please update this version check!
     # If your version of twisted doesn't need this, returning early is the
     # right thing to do.
     assert Version('twisted', 8, 2, 0) <= twisted.version <= \
-            Version('twisted', 11, 0, 0), \
+            Version('twisted', 12, 0, 0), \
             "monkeypatch failed version check; see note in monkey.py"
 
     import twisted.spread.pb
     from twisted.spread.interfaces import IJellyable
     from twisted.spread.pb import AsReferenceable
 
     def monkeyed_cbLogin(self, (interface, avatar, logout)):
         """