Comment 6 for bug 586359

Revision history for this message
Jonathan Lange (jml) wrote : Re: Virtual builders are sometimes very slow to accept connections

It would probably be useful to have a script that reproduces the problem without involving lp.buildmaster.

Something like:

  import errno
  import socket

  def connect_to_server_until_timeout(host, port, max_tries=10000):
      for i in range(max_tries):
          s = socket.socket()
          result = socket.connect_ex((host, port))
          if result == errno.ETIMEDOUT:
              return i
          if result == 0:
              s.close()
      raise RuntimeError("Did not timeout after %s tries" % (i,))

  if __name__ == '__main__':
      server = sys.argv[1]
      connect_to_server_until_timeout(server, 8221)

Note I haven't actually run that code.