Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-197

Add time.sleep(wait_period) to _ssh_client_connect()

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Compute
    • Labels:
      None

      Description

      In the event that the client cannot connect, it will run in a tight loop, needlessly using CPU cycles until it finally connects or times out.

      This patch puts a wait period in the loop, similar to what is done in _wait_until_running(). It also exposes a wait_period parameter in the function arguments.

        Activity

        Hide
        kami Tomaz Muraus added a comment -

        I've changed a timeout to 1.5 seconds and merged it into trunk. Thanks.

        Show
        kami Tomaz Muraus added a comment - I've changed a timeout to 1.5 seconds and merged it into trunk. Thanks.
        Hide
        jaydoane Jay Doane added a comment -

        I was seeing the pegged CPU behavior when I accidentally was trying to connect using ssh keys when I should have been using password. I admit that it was not a normal use case, but potential tight loops without sleep seem like a bad idea, IMO.

        Show
        jaydoane Jay Doane added a comment - I was seeing the pegged CPU behavior when I accidentally was trying to connect using ssh keys when I should have been using password. I admit that it was not a normal use case, but potential tight loops without sleep seem like a bad idea, IMO.
        Hide
        kami Tomaz Muraus added a comment -

        Yeah, it really depends on what kind of connection error it is. In a lot of cases it's a socket timeout which means ssh_client.connect will already block for quite a while (I don't know what's the Python default socket timeout, but you can get it by using 'socket.getdefaulttimeout()' method).

        Show
        kami Tomaz Muraus added a comment - Yeah, it really depends on what kind of connection error it is. In a lot of cases it's a socket timeout which means ssh_client.connect will already block for quite a while (I don't know what's the Python default socket timeout, but you can get it by using 'socket.getdefaulttimeout()' method).

          People

          • Assignee:
            kami Tomaz Muraus
            Reporter:
            jaydoane Jay Doane
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development