Cinder ssh_util sends no keepalive packet.

Bug #1673662 reported by Shunei Shiono
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Shunei Shiono

Bug Description

Expectation:
 When ssh_conn_timeout is set to N in cinder.conf,
 keepalive packets are sent every N seconds.

Result:
 No keepalive packets were sent.

Cause guessed:
 In ssh_utils.py, set_timeout(None) is called.
 But in paramiko/packet.py, the timeout seems to be needed
 to trigger sending keep alive packet.
 When I commented out set_timeout(None),
 keepalive packets sent as expected.

cinder/cinder/ssh_utils.py:L145
{{{
            if self.conn_timeout:
                transport = ssh.get_transport()
                transport.sock.settimeout(None)
                transport.set_keepalive(self.conn_timeout)
}}}

paramiko/paramiko/packet.py:L249-279
{{{
        while n > 0:
            got_timeout = False
...
            except socket.timeout:
                got_timeout = True
...
            if got_timeout:
...
                self._check_keepalive()
}}}

Revision history for this message
Saumya Gupta (guptasaumya73) wrote :

Is this information/request is a bug or some feature enhancement, as the intent is not clear??

Revision history for this message
Shunei Shiono (s-shiono) wrote :

This is a bug, I think.
According to the comment in ssh_utils.py, this utility supports to send keepalive packets.
However, in fact, it never sends keepalive packets because of the current implementation.

comment in ssh_utils.py:
`We are setting the sockettimeout to None and setting a keepalive packet
 so that, the server will keep the connection open.`

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/527309

Changed in cinder:
assignee: nobody → Shunei Shiono (s-shiono)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/527309
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=fca5fb9acf6f1fe1aafa8cee94a39918abaa4b27
Submitter: Zuul
Branch: master

commit fca5fb9acf6f1fe1aafa8cee94a39918abaa4b27
Author: Shunei Shiono <email address hidden>
Date: Tue Dec 12 14:38:25 2017 +0900

    Change ssh_utils parameter to correctly sends keepalive packets

    The current implementation of ssh_utils never sends keepalive packets.
    In ssh_utils.SSHPool, the socket timeout parameter is set to None
    intending to keep ssh connections open.
    However, when the parameter is set to None, ssh_utils does not run the
    code to compare idle duration and keepalive interval.

    This patch reverts the socket timeout parameter to default (0.1 sec).
    The ssh_utils compares them every 0.1 seconds, and sends a keepalive
    packet if idle duration > keepalive interval (= self.conn_timeout).

    Change-Id: I8234083107207b9ebc0849947e8de92b5cf3e36e
    Closes-Bug: #1673662

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 12.0.0.0b3

This issue was fixed in the openstack/cinder 12.0.0.0b3 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.